Ubuntu – recovering data from damaged Linux partition

data-recoveryUbuntu

I'm running Windows XP, with an Ubuntu partition that I added.
A few days ago, Ubuntu stopped booting. Trying to boot into Ubuntu just takes me into a Grub menu.

When I try to navigate through the command line to c:\ubuntu\disks, I get the message that "c:\ubuntu\disks is corrupt and unreadable. Please run the Chkdsk utility." I can navigate to c:\ anc c:\ubuntu\ through the command line, though when I try to open the C drive in My Computer, I get an error: "Windows cannot find 'RECYCLER\S-7-1-97-100014951-[etc]'.

I don't have a Windows disk or another hard drive, so I've just been trying unsuccessfully to run Chkdsk from the same c drive that's damaged.

When I try to run Chkdsk, I get the error: "The type of the file system is NTFS. Cannot lock current drive. Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)"

When I say Yes and restart, I get the white-letters-on-blue-screen message: "The type of the filesystem is RAW. CHKDSK is not available for RAW drives."

I found a site for Zero Assumption Recovery (ZAR) software, which seems to be able to recover data in cases like this, but I'm wondering if there are free alternatives or any other ideas for fixing the partition or recovering data.

I was getting that error in My Computer before I installed Ubuntu, a few months ago. So it seems to have slowly eaten into the Linux partition. I could try installing Ubuntu again, but there are a few files on that installation I'd like to recover.

Best Answer

Your main problem here is your Wubi filesystem is inaccessible due to NTFS corruption on your windows filesystem. You need a windows installation CD to run chkdsk from. There is no safe way around this. However, if that's not possible, there may be something you can try - but it may make things worse, so if at all possible, obtain a windows install CD from a friend in preference to this.

Boot from an ubuntu CD. When it's up, attach an external hard drive and open a terminal.

If your external hard drive is significantly larger than your internal hard drive, do a full backup first. This will take a long time:

sudo dd if=/dev/[your hard disk device] of=/media/[name of external hard drive]/backup.disk bs=131072

Then:

sudo mkdir /mnt/host
sudo ntfs-3g -o recover /dev/[your windows filesystem device] /mnt/host
cp /mnt/host/ubuntu/disks/root.disk /media/[name of external hard drive]/root.disk
e2fsck -v -f -C0 /media/[name of external hard drive]/root.disk
sudo mkdir /mnt/ubunturoot
sudo mount /media/[name of external hard drive]/root.disk /mnt/ubunturoot -o loop,ro

[your hard disk device] will likely be either sda or hda. [your windows filesystem device] will likely be the hard disk device with 1 at the end; if it isn't, add the contents of /proc/partitions to your question and comment on this answer.

If all goes well, you will have access to your files at /mnt/ubunturoot. If things go wonky, you may lose everything on your hard drive forever. If this happens and you made a backup, you can restore it by flipping the order of if= and of= in the backup command, but at that point you really will need to run chkdsk off an install disk.

Related Question