First, understand the difference between partitions and filesystems:
- Partitions are contiguous groups of sectors on the hard disk -- say, sectors 923,648 to 625,142,414. They're defined in simple data structures called partition tables.
- Filesystems are more complex data structures that facilitate storing files, including organizing them in directories, etc. Filesystems are normally stored within partitions, but they can also occupy a whole disk or be stored in other data structures (such as in an image file -- a filesystem within a filesystem, essentially).
If a partition is deleted, that means that its entry in the partition table is gone, but the filesystem within the partition is still OK. (Unless of course the partition was wiped before its entry was deleted.)
Thus, if you're able to access your filesystem at all, the partition that housed it has almost certainly been restored correctly, although there is one caveat: If the restored partition is too short, it could be that you're unable to read files that fall after the end of the partition. In this case, increasing the size of the partition without touching the filesystem data might help. Chances are, though, that the problem you're seeing is the result of filesystem damage. You say that the problem occurred when a partition-resizing operation failed. Such operations are inherently dangerous. Adjusting partition table entries is relatively simple, but partition resizing also means filesystem resizing, and that is tricky.
Your best hope of recovery is to focus on the filesystem aspect of the problem. You don't say what OS you're using, but all OSes offer tools to check and repair their filesystems, such as fsck
in Linux or CHKDSK.EXE
in Windows. Using those tools may help. Unfortunately, it's also possible that your filesystem is irreparably damaged. In this case, there are file-recovery tools that might help, such as PhotoRec. These tools can recover individual files from a damaged filesystem, but they're rather hit-or-miss and tedious to use.
One more point: Attempts to recover filesystem damage can sometimes make matters worse. Thus, you should do a low-level backup of the partition's contents before attempting to do any low-level repairs. In Linux or OS X, a tool like dd
can do the job, as in dd if=/dev/sda4 of=/path/to/backup-sda4.img
, which backs up the /dev/sda4
partition to a file. There are similar tools for Windows, but I'm less familiar with them.