Sometime a unreasoned actions, viruses, hardware or software failures adduce to
overwrite the first sector of hard disk. On this sector present partition table. If this sector will be broken all data on the device will be lost.
But in much cases have possibility to recover all extendend partitions and
sometime the primary partition too.
This utility can help you recover your hard disk.
How it work?
The partition table of your hard disk include four entry. Usually
first entry point to your primary partition (disk C: under DOS,Windows), second
entry point to extended partition. Two last entry usually unused.
Extended partition begin from the same table as main partition table and the first entry point to secondary visibly partition (disk D: under DOS,Windows), second entry point to the next extended partition... The program may be found extended partition by signature, and calculate the size of first partition.
(This will work in the most popular case when the extended partition begin nearly after first partition, in other cases you may direct the entry for extended partition and try to recovery preveus partitions manually)
/source/device -- e.g. /dev/hda -- for first IDE HDD,
/dev/sda -- for first SATA HDD, etc..
You must direct the name for file_to_save_old_partition_table
If in next, you make a changes, then you may return all back with command:
cat file_to_save_old_partition_table > /source/device
To minimize search time you may direct first and last cylinder betwen that
the program will be search.
NO WARRANTY
Warning: You use this software on your risk, to use it you must have notion about what is partition table.
This software distributed under GNU Public License. Absolutely no warranty.
Recommendation
Now I present this for Linux and if once when you turn on your PC it can't boot
and when you boot from some live CD you see empty disk I recommend the next algorithm for recovery:
First, don't write anything to your hard disk, because any record may overwrite important data.
Take the Linux live CD. It may be
Knoppix or any other, each Slackware installation disk. Boot from it.
Login as root, or change current user with 'su'
Take this utility and copy it to ram disk. (To take it after boot, you may use USB flush drive, floppy, or network)
Run it with this command like this:
./findpart /dev/hda old_parts
(In this example we try to recover primary IDE hard disk /dev/hda
Old partition table will be saved in current directory in file 'old_parts'
)
If extended partition will be found, you will seen next prompt:
Extended partition found at cyl 2048:
type: B; start at 63 (cyl 0) size: 41945652 (20481 Mb)
type: 5; start at 41945715 (cyl 2611) size: 144585 (70 Mb)
type: 0; start at 0 (cyl 0) size: 0 (0 Mb)
type: 0; start at 0 (cyl 0) size: 0 (0 Mb)
Next action:
n,f,v,l,b) recovery partition table (this will be extended partition, before this will by one primary partition)
f -- set primary as FAT
v -- set primary as FAT32
l -- set primary as Linux
b -- set primary as FreeBSD
n -- set primary as NTFS
1,2,3,4) change entry 1..4 in current partition table to point to this extended partition
c) continue search
q) quit
There you may look the extended partition that has been found. If you see that
it isn't partition table (it may be if the same signature found occasionally;
the extended partition table must have one or two filed entry, usually start sector in first entry is 63, and if second entry is used this type must be five) press 'c' to continue search.
If type of your primary partition (Linux ext2/ext3,FAT,FAT32,FreeBSD,NTFS) chose it. In any case after do it run
fdisk /dev/hda
With fdisk you may check your partition table (p - command) and make some changes.
If you look that the partition table is wrong, then you may return all back
with command: