Ubuntu – Moved ubuntu folder from C: to D: drive how to correct UUID entries


I had a previous Ubuntu 11.10 installation which was done using Wubi in
D: drive of my computer. The corresponding grub.cfg entries are:


Now I wanted to use Ubuntu 12.04 so I deleted the previous
installation from the D: drive
and then installed Ubuntu 12.04. I accidentally installed it to the C: drive instead of installing it in
the D: drive, and the grub entries here are

I didn't have enough space in the C: drive so I moved the ubuntu folder from
C: drive to D:, but surprisingly it could not boot.
Realizing that grub.cfg needed to be updated I opened the old grub.cfg
(this 11.10 was installed in D: drive)

and checked the UUIDs grub.cfg which are (for previous 11.10 install in D: drive)

search --no-floppy --fs-uuid --set=root 8E9E86339E86143D

linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=8E9E86339E86143D
loop=/ubuntu/disks/root.disk ro

in the new 12.04 grub.cfg (which was accidentally installed in C: drive )

has following grub.cfg (for 12.04 in C: drive)

search --no-floppy --fs-uuid --set=root E4ACAFF5ACAFC082
linux   /boot/vmlinuz-3.2.0-29-generic root=UUID=E4ACAFF5ACAFC082
loop=/ubuntu/disks/root.disk ro

I have since moved the entire Folder C:\ubuntu to D: drive so it is
now D:\ubuntu

what I notice is the old UUID entries (from 11.10 ) are not the same
as the UUID entries in 12.04 is there a way to fix this?

Best Answer

Hold down Shift key after selecting Ubuntu. Press E to edit grub entries manually if you know how. Then Ctrl+X to boot.

If you don't know how to edit the grub entries, press C to get to a grub prompt. Then enter the following:

search -s -f -n /ubuntu/disks/root.disk
probe --set=diskuuid -u $root
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
linux /vmlinuz root=UUID=$diskuuid loop=/ubuntu/disks/root.disk ro quiet splash
initrd /initrd.img

After booting, enter sudo update-grub to fix grub.cfg.