Recently I have been working with GRUB to boot a rescued harddisk, I have searched for many solutions but it seemed those commands presented in those search were from grub legacy.

To Install GRUB2 to MBR using LiveCD

1. Use a LiveCD that has grub2 distribution, if do not have connect to the internet and download using apt or yum depending on your Linux distro, some distro does not have apt and yum.

2. Mount the harddrive to /mnt/. To specifically create a sub directory under /mnt/:

install -d /mnt/myhdd/

mount /dev/sda1 /mnt/myhdd/

/dev/sda1/ is an example, you should use fdisk -l command to observe your harddrive partition number. In this example /dev/sda1/ is the partition that contains the /boot/ directory and itself is also mounted on /.

3. Use grub-install to install the grub2 to /dev/sda/ MBR. You need root access.

grub-install –root-directory=/mnt/myhdd/ /dev/sda/

4. Reboot. You will see a grub prompt:


Lots of solution I have googled could not be used for my situation:

Commands presented in this post are not present in my grub. It is obvious that these commands are from grub legacy.

This one looks the most promising, it contains great tutorials unfortunately my grub does not have the commands (particularly kernel command) the tutorial presented. Oh by the way I am using grub version 1.98.

This tutorial is the saviour, it accurately documented the commands I need for my situation.

In the grub prompt, type:

set root=(hd0,1)

before doing this you should do ls command to see the available hd0.

hdX,Y where X is the number of the harddisk drive number and Y is the partition number. Partition number starts from 1 and not 0. So for my situation /dev/sda1 is hd0,1.

linux /boot/vmlinuz-<version>.i686 root=/dev/sda1 ro

This command tells grub where to load the kernel and which is the root partition, for my situation /dev/sda/ is /. The kernel is located in /boot/ directory.

initrd /boot/initrd-<version>.img 

For my situation the initrd image is stored in /boot/ directory.

Once ok I can issue boot command to boot the computer.


set root=(hdX,Y)

linux /boot/vmlinuz /dev/sdXY/ ro

initrd /boot/initrd.img


After everything is initialzed run update-grub command so that next time my system can boot, the above commands are temporary commands.

This entry was posted in Linux, System OS and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s