You must understand the difference between two things:
- Partitions are contiguous sections of a hard disk, identified by sector numbers, such as sectors 2,048 to 41,943,040. Partitions are defined in a data structure called a partition table, which is simply a list of sector ranges and some simple associated data (such as a type code to identify the type of data the partition contains). Two common partition table types are MBR and GPT, although that's not really important for your problem.
- Filesystems are much more complex data structures that enable storing, organizing, and locating individual files on the disk. Filesystems are often stored inside partitions, which simply means that they occupy the range of sectors identified by the partition table as being a particular partition. Numerous different filesystems are available, such as FAT, NTFS, HFS+, ext4fs, and so on.
In order to use a filesystem, you must normally have an intact partition table so that the OS can locate the filesystem. (An exception is if the filesystem occupies the entire disk, as was common with floppies and is sometimes done with USB flash drives.) TestDisk repairs damaged partition tables by searching for evidence of filesystems and creating new partition table entries to match any filesystems it finds -- essentially working backward from the usual case. TestDisk can not fix damage within the filesystem, though. For that, you need to use filesystem-specific repair tools, such as CHKDSK.EXE
in Windows for FAT or NTFS or e2fsck
in Linux for ext2/3/4fs.
Partition resizing operations involve both adjusting the filesystem data structures and adjusting the partition data structures. When your partition-resizing operation failed, it probably left the filesystem in an inconsistent state, and it may have left the partition table in an inconsistent state, too. If the partition table data has been adjusted to claim a smaller partition than is needed by what remains of the filesystem, you might be able to correct the problem by using a partitioning tool like GPT fdisk (gdisk
) to delete the partition table entry and create a new one with the same start point but an end point that extends out to the required size. This is far from guaranteed to work, though, and if you make a mistake you could end up creating more problems. It might be worth using gdisk
or some other tool to check the sizes of your partitions, though; if the NTFS partition you were trying to shrink shows up as being small in gdisk
or another tool that modifies partitions only (not filesystems), then it might be worth trying to resize the partition. OTOH, if gdisk
shows the partition as having little or no space between it and the next partition or the end of the disk, then you shouldn't mess with this further, and you should instead focus on filesystem-level repairs.
It's more likely that your problems are caused by filesystem damage exclusively. If so, and if CHKDSK.EXE
can't recover anything more, than your only hopes lie in third-party recovery tools. Something like PhotoRec might be able to recover individual files, for instance. (I've heard that there are Windows-specific tools that can do a better job than PhotoRec on NTFS volumes, but I don't have any URLs handy.) There might be some third-party CHKDSK
-like tool that would do a superior job, too, but I don't know of such a tool; I mention this because it may be worth your while to do a Web search on the subject.
One more comment: You're at a state where it's almost as likely that you'll do more damage to the disk trying to recover it than that nothing bad will happen. Thus, it's best to do a low-level backup of the disk. There are Windows tools to do this, but I'm not familiar with them. In Linux, something like dd if=/dev/sda of=/path/to/backup/file.img
will do the trick, where /path/to/backup/
is the path to a directory on another physical disk that has sufficient free space to hold the entire disk you're backing up (/dev/sda
in this example). If you fail to make such a backup, any mistakes you make will make it harder, and perhaps even impossible, to recover some of your data.
If all of this is beyond you, there are paid data-recovery services you might use. I don't happen to have any URLs offhand, though, and such services tend to be pricey.