0

My wubi files were corrupted and i had to re-install ubuntu (through wubi) again. Before i un-installed the old ubuntu i saved the old root.disk in external drive.After i installed i tried to boot ubuntu (12.04 LTS), to make sure it works.Everything works fine. But when i copy the old root.disk in ubuntu/disks folder and boot to ubuntu it takes me to Grub shell/command line.After browsing online i came across this soulution

  set root=(hd0,1)
  loopback (loop0) /ubuntu/disks/root.disk
  set root=(loop0)
  linux /boot/vmlinuz root=/dev/sda1 loop=/ubuntu/disks/root.disk ro
  initrd /initrd.img
  boot

Line number 4 doesn't work, doesnt seem like there is file vmlinuz-... Can somebody please give me step by step commands to boot into ubuntu. My machine is window 7.

sparks
  • 103
  • 2

1 Answers1

0

Assuming the root.disk you copied wasn't corrupted... you can boot it as follows:

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
boot

After booting, make sure you run sudo update-grub

Wubi corruption is most common on the NTFS file system (requires running chkdsk /f from Windows), followed by corruption of the internal ext3/4 filesystem. Since you managed to copy your root.disk you may have internal corruption, in which case running fsck root.disk might fix it. But this depends on when you made your backup (i.e. before or after you encountered the problem).

To fsck the root.disk you can boot an Ubuntu DVD/USB, Select Try Ubuntu, then mount the partition that contains the root.disk and then fsck it as follows (this example assumes the root.disk is on /dev/sda1):

sudo mount /dev/sda1 /mnt
sudo fsck -fyv /mnt/ubuntu/disks/root.disk

(flags are force, yes to fix automatically, verbose)

Note: fsck used in this way does make changes and there's no guarantee it will fix everything without data loss. If recovery is critical it's possible to use photorec (which comes bundled when you install testdisk i.e. sudo apt-get install testdisk). Photorec is read-only (non-destructive) and can recover raw files. The downside is that the recovered files are not named, and it recovers everything e.g. deleted files as well - so there is some manual effort to find the ones you are after. It does provide the ability to target specific file types though. See here for more info: Recover deleted data with rm -rf?

bcbc
  • 6,026
  • Ok I am going to try it today. Please bare with me i had other issues on windows side.What is the line probe --set=diskuuid .... for? – sparks Dec 03 '13 at 16:11
  • @sparks probe --set=diskuuid gets the UUID of the partition that the root.disk resides on. Previously you'd have needed either the UUID of the partition number (/dev/sdXY) to boot and this isn't always obvious. – bcbc Dec 03 '13 at 17:12
  • When I do linux /vmlinuz root=UUID=$diskuuid .... I get error file not found – sparks Dec 04 '13 at 02:11
  • @sparks I'd try mounting the root.disk from a liveCD to attempt data recovery and then fscking it. It seems likely that it's corrupted. – bcbc Dec 04 '13 at 05:50
  • Oh ok thanks, but I don't have a live cd though. – sparks Dec 04 '13 at 07:09
  • @sparks you could create one, or if you do a fresh Wubi install, you could use that to fsck the root.disk of the old one. If you create one you could also do a normal dual boot which is more reliable than Wubi which is designed more to try out Ubuntu. – bcbc Dec 04 '13 at 17:46
  • I wanted to copy my files from the old root.disk with ext2read first, but the home folder is not browsable and it is 0 bytes. The root.disk itself is 17 gb tthough. Any ideas what is going on?I have tried running chkdsk in C:\ several times. In that case booting with CD/usb will make a difference? T – sparks Dec 05 '13 at 17:18
  • @sparks this is likely ext3/4 filesystem corruption. The only way to fix that is fsck (e2fsck). There is no guarantee it will, but without it, you have 0 bytes in /home so... that appears to be your only option. For a pure data recovery there is one other alternative (I'll add to answer). – bcbc Dec 05 '13 at 19:17