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 :
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 “
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.