I had three primary partitions on my hard-drive:
- Win7 NTFS (300G)
- linux / (600G)
- linux swap (30G)
As I needed more space on Win7 I deleted the second partition inside windows and grow the NTFS to incorporate the free space. Worked fine until the next reboot. This what I saw then:
The partition layout was changed, so that the former swap partition was reused as linux partition:
- Win7 NTFS (900G)
- linux / (30G)
My disk are organized in a raid 1 mirroring set, so it is not really /dev/sdaX, (see next picture). The linux on this dual boot machine is only for emergency rescue stuff, so I easily can reinstall it, without loosing content. When installing the Ubuntu 10.04 LTS I also node down the name of the raid set names, which play a vital part in the restoration of the grub boot loader.
Finished the ubuntu linux install.
Starting the grub rescue. If you ever see this
error: no such device: gksdfksdklhsdkhjsdkkdh grub rescue>
DON’T PANIC! – grub is confused about the latest changes to you partitioning and his knowledge about the system setup, but it usually does know still some things. And here is how to proceed.
Enter the following to see the what grub still knows.
grub rescue> set prefix=(hd0,2)/boot/grub root=hd0,2 grub rescue>
It knows that there should be a linux on the second partition of the first hard-drive. But the disk UUID has changed and therefore it bailed out. So now we need to load the normal grub mode:
grub rescue> insmod normal grub rescue> set color_highlight= color_normal= pager= prefix=(hd0,2)/boot/grub root=hd0,2 grub rescue>
Worked! We have more commands to our grub now. Let’s see what we have in /boot and we proceed in loading linux kernel
grub rescue> ls /boot ./ ../ grub/ System.map-2.6.32-21-generic abi-2.6.32-21-generic config-2.6.32-21-generic memtest86+.bin vmcoreinfo-2.6.32-21-generic vmlinuz-2.6.32-21-generic initrd.img-2.6.32-21-generic grub rescue> insmod linux grub rescue> linux /boot/vmlinuz-2.6.32-21-generic root=/dev/mapper/isw_baafeifjp_Klawiklack2 grub rescue>
So we have told grub which kernel to boot, and where the root fs is located. We need to tell grub about the initrd.
grub rescue> initrd /boot/initrd.img-2.6.32-21-generic grub rescue> boot
And now the linux does boot! Inside the linux we need to run the following command to correct the grub settings.
root@klawiklack# dpkg-reconfigure grub-pc
And finally we see the grub boot loader screen again
Don’t forget that Windows does a lengthy fsck too.