Grub is the default bootloader for the most popular Linux distributions. The installation procedure is not so easy if you’re not familiar with the concept behind it.
After a restore or copy of a system to a new harddisk the bootloader needs to be reinstalled to this new disk. If you are using a live cd environment here are some tips to get this task done fast.
Each time I had to restore an old linux machine with Grub as its bootloader I searched the web for a tutorial and found many references to the grub-install command. For me this tool didn’t work in many cases. Whatever changed in these special cases with the old grub command and grub shell was was 10times faster.
Maybe one of you knows why grub-install fails for me .. could it be of a different kernel versions from live cd and installed environment or I did something wrong.
In this example we have one disk sda with 3 partitions:
sda1 = /boot
sda2 is swap partition
sda3 = /
Grub has a different namespace. The first disk is hd0 and partitions are named for example hd0,0 for sda1.
To install grub to the first disk with sda1 as its boot partition run:
This starts the grub shell, with root (hd0,0) you set the partition where grub has access to the kernel. The command setup(hd0) writes grub to the mbr of sda.
You need to be sure you /boot partition has all required files for booting the linux system and all required files for grub. Review your grub configuration (for example /boot/grub/menu.lst) and have fun with your new grub installation.