Grub Rescue

I was playing around with my laptop by changing the partitions in my system. I wanted to extend the size of my linux partition. But when I tried with Gparted in the current OS, I was unable to unmount the root from partition and hence unable to resize. I inserted a bootable CD containing Gparted and then unmounted the partition containing linux. Then I increased the size.

But the problem started when I restarted the machine. I was not getting the usual Grub options. Instead I got a message telling “file-system unable to locate” containing grub rescue prompt. It was Grub-2 where I was working. I figured out that the problem arised because I didn’t mount the root back to the partition. I could solve the issue without a bootable disk. You just have to follow the commands below :

set prefix=(hdx,y)/boot/grub

x is your hard disk number and y is the partition number. My partition number was 6 and hence I gave “set prefix=(hdx,y)/boot/grub “

insmod (hdx,y)/boot/grub/linux.mod

The above two command will put grub in regular command mode. This is the extra step you need in case of GRUB2. The below three steps are options.

insmod part_msdos 
insmod ext2
 insmod gzio

After that, the usual Grub commands are :

set root=(hdx,y)
 linux /boot/vmlinuz-3.2.0-23-generic-pae root=/dev/sdX ro
initrd /boot/initrd.img-3.2.0-23-generic-pae 
boot

I was  able to boot the system as previous. I also increased the partition size.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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