Installing GRUB

GRUB( GRand Unified Boot loader) can be installed in many ways
  • from current linux installation
  • from live cd

  1. Installing GRUB from current linux.
  2. Type the command
    # grub-install /dev/sda
    where sda corresponds to the harddisk where the boot loader is being installed. The boot loader is in a small portion and hence it keeps all other necessary files in another location. By default the boot loader takes the configuration for the grub from /boot/grub/menu.lst


    note: If the command was executed from a live cd then the grub will look for menu.lst in /boot/grub/ which is actually in the 'cd rom'. Therefor simply executing the command from a live cd won't work.

  3. Installing from a rescue cd

  4. Rescue disks gives an option to boot into an already installed OS.(For example Suse gives options to boot into installed SUSE, Fedora gives option for 'chroot'into already existing fedora)
    From there type command
    # grub-install /dev/sda
    It will install grub.

  5. Installing from a live cd

  6. I am considering Ubuntu as an example

    execute the following commands

    #sudo grub
    grub>find /boot/grub/stage1
    grub>root (hd0,0)
    grub>setup (hd0)

    entries for other OS (like windows ) has to be added manually.
  7. Another method to install from a live cd


  8. $ sudo mount /dev/sda1 /media/disk
    $ sudo mount --bind /dev /media/disk/dev
    $ sudo chroot /media/disk
    # grub-install /dev/sda
    # exit


1 comments:

    thanks was useful..