Ubuntu – Can I mount a Wubi .disk image in a new Wubi installation

wubi

I've bricked my Ubuntu Wubi installation and as a result I can't get to the log-in screen. The computer sits at a blank, off-black (that kinda deep red/brown) screen after I've selected which Kernel to boot.

Is there any way I can install a fresh copy of Ubuntu via Wubi and then mount the old image?

Best Answer

Ideally you'd use a live CD - since you might be able to repair the current Wubi install. If you need data off it you could also try ext2read, which gives read-only access to the root.disk from Windows.

If you decide to access via a new Wubi install, it's critical to copy the *.disk files outside the \ubuntu directory before installing, since the first step of the Wubi install is to remove any existing install - and that deletes everything. Normally (on NTFS) there is only the root.disk that you care about, but if you install on a FAT32 partition or created a separate virtual disk for /home you can have others.

Let's say you moved (quicker than copy) the root.disk to \ubuntubackup\root.disk. Then when you install a fresh Wubi on the same 'drive', you can mount the old one as follows:

sudo mount -o loop /host/ubuntubackup/root.disk /mnt

Then you can use nautilus (or some other file browser) to view the files e.g. from a command prompt you could enter: nautilus /mnt/home

Attempting repairs

Wubi problems are often caused by hard reboots, perhaps after an apparent freeze. Forced shutdowns can damage any filesystem, but Wubi is more sensitive since it's whole partition is virtual, the root.disk. The steps to fix are:

  • Run chkdsk /f (or /r) from Windows. The corruption can be on NTFS and/or on the ext3/4 filesystem within the root.disk. In your case, you get past the grub menu, so it's probably only the ext3/4 filesystem, but I might run chkdsk anyway.
  • After chkdsk check that the root.disk is still there. This may sound strange, but Windows will sometimes move files it repairs to a hidden \found.000 directory. It may rename the root.disk to chk0000.chk so look for it by size (5-30GB). See this for more info.
  • Now run fsck on the root.disk. You'll need to boot an Ubuntu CD or USB for this. Then mount the host NTFS partition. E.g. if your root.disk is on /dev/sda3:

    sudo mount /dev/sda3 /mnt

    sudo fsck /mnt/ubuntu/disks/root.disk

Other possibilities

  • You could try booting an older kernel.

  • Boot in recovery mode.

  • Check there's enough free space to boot (by mounting the root.disk from the live CD and then freeing up space if required, or resizing on the fly).

Related Question