Installing Grub

Create a GRUB Boot Disk

A grub boot disk is useful for installing grub on a hard disk. The GRUB package is usually installed in /boot/grub.

  1. Mount a FAT format floppy on a Linux system. This will usually be mounted on /mnt/floppy or /media/floppy.
  2. Copy /boot/grub to the floppy. The files need to be in a directory called grub. We will create the directory and then copy the files to it. That way if there are any symlinks they will be copied as files. (Rather than use cp -r)
    # mount /mnt/floppy
    # mkdir /mnt/floppy/grub
    # cp /boot/grub/* /mnt/floppy/grub/
    # umount /mnt/floppy
    
  3. As the root user run grub.
    # grub
    
  4. Put the boot loader on the floppy
    grub> root (fd0)
    grub> setup (fd0)
    grub> quit
    

Repairing an MBR

So your MBR gets toasted by a Windows install or Ghosting a drive. If your Linux is still there then this is all you have to do to bring it back to life. (Assuming it was booting with grub before.)

  1. Boot from your GRUB boot floppy and find the partition that your grub files are installed on. GRUB has a find command to locate the right partition. It may list more than one if you have mirrored drives. If that is the case, they will be identical, so it doesn't matter which one you use.
    grub> find /grub/grub.conf
    (hd0,0)
    
    If /grub/grub.conf doesn't work try menu.lst instead of grub.conf. Some non-RedHat/Fedora systems will use this. Also, if you don't have a seperate boot partition you may have to stick /boot on the front of the path. So, if you don't know the lay of the land, try these until one works:
    grub> find /grub/grub.conf
    grub> find /boot/grub/grub.conf
    grub> find /grub/menu.lst
    grub> find /boot/grub/menu.lst
    
  2. Use the device name you found with the find command. In the above example it was (hd0,0), replace that with the value you get with find command.
    grub> root (hd0,0)
    grub> setup (hd0)
    grub> quit
    

Credit where credit is due: Checkout the very good article about GRUB in Linux Magazine's Guru Guidance column, November and December 2003.