Is there a chkdsk equivalent available for Ubuntu?

Solution 1:

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.

Solution 2:

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

Solution 3:

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.

Solution 4:

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.