10

When I asked this question about recovering data from a damaged Linux partition, people recommended booting from a Windows installation disk and running Chkdsk. Well, I still don't have a Windows disk, but I do have an Ubuntu 8.04 disk. Is there a Chkdsk equivalent I might be able to run from the Ubuntu disk that might help to restore or recover the data on my Linux partition?

4
  • Do you have an actual separate partition or a virtual disk on top of NTFS? Jul 30, 2009 at 18:58
  • 1
    It appears to be a Wubi installation.
    – DLH
    Jul 30, 2009 at 19:31
  • That seems to be an important little detail. Jul 30, 2009 at 19:37
  • How do you have a Windows installation with Ubuntu installed via Wubi, but not have a Windows disc?
    – jtimberman
    Aug 2, 2009 at 5:47

4 Answers 4

6

Are you shure that you have corrupted partition? Maybe you have erased boot-record or damaged partition table. Try to investigate the problem at first. Describe how did you installed your Linux. From your previous question it looks like it's installed on flat file inside of windows (vfat or ntfs) partition. Try to run fdisk and look at your partition table.

Before making any changes to hard drive try to make image of your hd (you can do that at your friends).

UPDATE:

 
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders 
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x903bd648

Device Boot Start End Blocks Id System 

/dev/sda1 * 1 4864 39070048+ 7 HPFS/NTFS

As we can see there is just one NTFS patrition so I suspect that you installed Ubuntu using WUBI (or something similar).

Your Linux is installed in a loop-mounted partition which is just a file or couple of files somewhere on your windows disk c: (c:\ubuntu\disks for example)

As I see from your previous question you can boot Windows so you could use dskprobe from Windows XP Service Pack 2 Support Tools to make sure that fs type is correct ... but it's already correct fs type 7 is NTFS.

Message "The type of the filesystem is RAW. CHKDSK is not available for RAW drives." means that windows can't determine fs type for some reason. As we see fs type is correct.

To run Chkdsk on your Windows partition you can install Windows Recovery Console, boot in recovery console and check your disk.

After checking the disk you will gain access to you c:\ubuntu\disks. I think you can mount your linux partition (which is in file) as usual loop-back device:

mount -o loop [path to your linux-loopback-partition]

But you should mount windows patrition first.

2
  • I ran fdisk and got these results: <pre> ubuntu@ubuntu:~$ sudo fdisk -l Disk /dev/sda: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x903bd648 Device Boot Start End Blocks Id System /dev/sda1 * 1 4864 39070048+ 7 HPFS/NTFS </pre> Aug 6, 2009 at 22:32
  • Thanks Bolotov. So, within the recovery console I will be issuing the commands "chkdsk -r" and then "mount -o loop [path to windows partition]" and then "mount -o loop c:\ubuntu\disks", correct? I do have a ("corrupt and unreadable") c:\ubuntu\disks directory so that appears to be the correct path to the linux partition; do you know the path to the windows partition? would that be just "c:\"? Aug 7, 2009 at 17:09
2

Since you appear to be using a Wubi installation on NTFS and don't have an actual Ubuntu partition, the answers posted for ext would not work.

ntfsprogs contains some utilities for NTFS, including ntfsfix, which flags the file system so that Windows will attempt to fix it on the next reboot. bdonlan's answer to your other question could work; I'm honestly not sure what's best. If anyone has a better solution for a Wubi installation in NTFS, please post it.

1

To recover data from a linux partition, you don't want to run the chkdsk equivalent. It will most likely notice that your lost data isn't connected to anything and delete most traces of it from the filesystem, making recovery even harder than it was before. You should instead use specialized tools for the filesystem which look at the filesystem internals much like fsck does to remove inconsistencies:

  • ext2: try to use the undelete tool as explained on this page
  • ext3: it is much harder, but you can usually recover many of your files using ext3grep, which is outlined on a very long and techincal page. You can skip the top part if you just want to know how to use the tool, but it was very useful to read the top section for me.

If you are on ext2 or ext3, you can also try this DiskInternals tool. I have not used this myself though, and I have successfully used both of the tools above

3
  • The page for ext3grep says that it "does NOT deal with a corrupted file system, only with accidently deleted files."
    – DLH
    Jul 30, 2009 at 19:23
  • ext3grep worked in my case when it was a corrupted filesystem (not fully corrupted though, fsck could "undo" the damage on an image of the drive)
    – jamuraa
    Jul 30, 2009 at 19:31
  • Interesting. However, he appears to be using a disk image inside an NTFS file system. I'm not sure if these would be useful in this case. He may require a tool that will recover the corrupted data in the NTFS system.
    – DLH
    Jul 30, 2009 at 19:37
1

You probably want "badblocks".

Here's a good howto for linux file systems (ext2) that shows how it can be used: http://ubuntu-rescue-remix.org/node/50

Not sure how that would help you with NTFS though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .