Subscribe:
    Subscribe Twitter Facebook

    Wednesday, October 7, 2009

    Restoring Grub Boot Loader




    Method 1: The Usual Way....
    After Installing WindowsXP, Boot a Linux Rescue Disk and Re-Install Grub with the command. "grub-install"

    read man grub for more info.

    typically....

    CODE

    mount /dev/your_boot_partiton /boot
    grub-install --root-directory /boot /dev/hda



    Method 2: The Easy, 733T haX0r Linux GuRu Way....

    The Boot Sector is Stored on the first 512 Bytes of the physical Disk.

    so... Backup your boot sector to a file like so...

    CODE

    dd if=/dev/hda of=/BootSectorBackup.bin bs=512 count=1


    Copy the backup file to a floppy disk / whatever.

    Install Windows XP.

    Boot a Linux Rescue Disk.

    then Copy your Origonal Boot Sector Over whatever Garbage WindowsXP put there with the command

    CODE

    dd if=/BootSectorBackup.bin of=/dev/hda bs=512 count=1




    If at all in Doubt... Use Method 1..
    If you Make a Mistake With Method 2, you can waye boodbye to your Partiton Table... File System, and look forward to a full re-partiton and re-format.

    In case of Any problem use below methods

    If you can boot from CD, simplest method is to mount linux partitions, then chroot to it, then run grub-install.
    TIP: fdisk -l will display all partitions at all drives.

    Method 3:

    In general, for any distro, even you havn't live CD, restoring can be done in such steps:
    1) Find any working linux sustem
    2) Create GRUB boot floppy:
    # cd /usr/share/grub/i386-pc
    # dd if=stage1 of=/dev/fd0 bs=512 count=1
    1+0 records in
    1+0 records out
    # dd if=stage2 of=/dev/fd0 bs=512 seek=1
    153+1 records in
    153+1 records out
    3) Boot from that floppy, then (quote from GRUB info page):

    Once started, GRUB will show the command-line interface (*note
    Command-line interface:. First, set the GRUB's "root device"(1)
    (*note Installing GRUB natively-Footnote-1: to the partition
    containing the boot directory, like this:

    grub> root (hd0,0)

    If you are not sure which partition actually holds this directory,
    use the command `find' (*note find:, like this:

    grub> find /boot/grub/stage1

    This will search for the file name `/boot/grub/stage1' and show the
    devices which contain the file.

    Once you've set the root device correctly, run the command `setup'
    (*note setup::

    grub> setup (hd0)


    For more information type info grub


    The RHEL installer provides the GRUB boot loader, GRUB (the GRand Unified Boot-loader).

    /boot/grub/grub/grub.conf has a format of global options followed by boot stanzas. Here is a sample grub.conf:


    timeout=5
    splashimage=(hd0,0) /grub/splash.xpm.gz
    password --md5 $1$/iX9y$Bkskfdsd4443gnff
    default=0
    title Red Hat Enterprise Linux AS (2.6.9-648_EL)
    root(hd0,1)
    kernel /vmlinuz-2.6.9.EL ro root=/dev/VolGroup00/LogVol00

    initrd /initrd-2.6.9-648.EL.img
    title Windows XP Pro
    rootnoverify (hd0,0)
    chainloader +1


    IF ggrub-install fails for some reason try the following:

    1. type the command grub and press enter

    2. type root (hd0,0)

    3. type setup (hd0)

    4. type quit



    IF still problem occures, then reinstall the grub by

    /sbin/grub-install /dev/hda or use these three commands:

    0 comments:

    Post a Comment

    Bidvertiser