使用范例

From CGSecurity
Jump to navigation Jump to search

En.png English De.png Deutsch Es.png Español Fr.png Français Ru.png Русский


You can see some complexe examples of data recovery with TestDisk.

The type of the file system is RAW - Recovery of a damaged FAT boot sector

Analyse Disk 80 - CHS 3737 255 63 - 29313 MB (Enh BIOS mode)
1 * FAT32                    0   1  1   382 254 63    6152832 [LOKAL DISK]
2 E extended LBA           383   0  1  3736 254 63   53882010
Partition sector doesn't have the endmark 0xAA55
5 L FAT32                  383   1  1  3736 254 63   53881947
5 L FAT32                  383   1  1  3736 254 63   53881947

The boot sector of the logical FAT32 partition is damaged. (Windows error message is usually The type of the file system is RAW. or The disk in drive D is not formatted. Do you want to format it now?) In Advanced, select this partition:

Interface Advanced
1 * FAT32                    0   1  1   382 254 63    6152832 [LOKAL DISK]
2 E extended LBA           383   0  1  3736 254 63   53882010
5 L FAT32                  383   1  1  3736 254 63   53881947
Boot sector
test_FAT :
Partition sector doesn't have the endmark 0xAA55
Backup boot sector
OK
First sectors (Boot code and partition information) are not identical.
Second sectors (cluster information) are not identical.
Third sectors (Second part of boot code) are not identical.

The backup boot sector is valid, choose Backup BS to copy backup boot sector over boot sector. If Backup BS isn't available, choose RebuildBS.

Recovery of a lost and damaged NTFS

Analyse Disk 81 - CHS 2434 255 63 - 19092 MB (Enh BIOS mode)
No partition is bootable

No partition is available.

Analyse Disk 81 - CHS 2434 255 63 - 19092 MB (Enh BIOS mode)
L FAT32                 1275   1  1  2433 254 63   18619272 [NO NAME]

Only the second NTFS partition is found during Quick Search. Select Deeper Search to try to find more partitions.

Analyse Disk 81 - CHS 2434 255 63 - 19092 MB (Enh BIOS mode)
* HPFS - NTFS              0   1  1  1274 254 63   20482812
L FAT32                 1275   1  1  2433 254 63   18619272 [NO NAME]

Both partitions have been found, but the first NTFS has been found using backup boot sector, we need to restore the boot sector. Choose Write and next choose Backup BS to copy backup boot sector over boot sector.

Recovery of a Dell computer

On Dell computer, there is a special partition called DellUtility. It's a FAT16 partition that is not visible from Windows because its partition type is DE.

Disk 80 - CHS 4865 255 63 - 38162 MB (Enh BIOS mode)
* FAT16 >32M               0   1  1     3 254 63      64197 [DellUtility]
P HPFS - NTFS              4   0  1  4864 254 63   78091965

After Analyse, select the DellUtility partition, use 'T' to change the partition type to DE. Use the arrow key to boot on the NTFS partition.

Disk 80 - CHS 4865 255 63 - 38162 MB (Enh BIOS mode)
P Dell Utility             0   1  1     3 254 63      64197 [DellUtility]
* HPFS - NTFS              4   0  1  4864 254 63   78091965


Problem of disk geometry - When all partitions are deleted

In this case, all partitions have been deleted. TestDisk show no partition! The user has run testdisk /debug /log. Extract of testdisk.log

Analyse Disk /dev/hdb - CHS 5169 240 63 - 38161 MB
No partition is bootable
search_part()
Disk /dev/hdb - CHS 5169 240 63 - 38161 MB
FAT32 at 0/1/1
heads/cylinder 255 (FAT) != 240 (HD)

A FAT32 partition has been found but there is a warning about harddisk geometry. The BIOS has selected another harddisk geometry because of the content of the MBR (empty in this case). Under TestDisk, choose geometry, set the number of heads to 255 instead of 240 and run again Analyse.

Two FAT32 partitions to recover

There were two FAT32 on the harddisk but they have been deleted. After running Analyze, Quick Search and even Deeper Search, TestDisk has found only the second partition.

Disk 81 - CHS 525 255 63 - 4118 MB
L FAT32                  384   1  1   524 254 63    2265102

Using A to add what we think is the missing partition, a new partition table have been written with two FAT32:

1 P FAT32                    0   1  1   383 254 63    6168897
2 E extended               384   0  1   524 254 63    2265165
5 L FAT32                  384   1  1   524 254 63    2265102

Using Advanced, Boot, RebuildBS, we have try to rebuild the boot sector of the first FAT32. Using List, it is possible to see a listing of files from the root directory but there is also a lot of garbage... Nothing has been written. In the log file (Expert mode can give this information), we can see that 4 copies of FAT32 have been found:

FAT32 at 32(0/1/33), nbr=123
FAT32 at 8221(0/131/32), nbr=123
FAT32 at 16097(1/1/33), nbr=1234
FAT32 at 22100(1/96/51), nbr=1234

Normally only two copies of FAT should be found. There are remaining data from two different FAT32 partitions: one beginning at 0/1/1, the second at 1/1/1. We have done a mistake. This time, we add the correct partition and choose to Write

1 E extended                 1   0  1   524 254 63    8418060
5 L FAT32                    1   1  1   383 254 63    6152832
6 L FAT32                  384   1  1   524 254 63    2265102

With RebuildBS (Advanced/Boot), we have been able to successfully rebuild the boot sector.

Lost partition after defrag

After running defrag against the first partition, the second FAT32 drive vanishes. When checking the partition table, TestDisk detects a problem with the first partition and no logical partition.

Disk 81 - CHS 1245 255 63 - 9766 MB
check_FAT: Incorrect size of partition
 1 * FAT32 LBA                0   1  1   746 254 63   12000492
 1 * FAT32 LBA                0   1  1   746 254 63   12000492
 2 E extended               747   0  1  1244 254 63    8000370

TestDisk has been able to find the first partition but this partition is one sector bigger than the actual partition entry. Defrag has overwrite the beginning of the extended partition, clearing the logical partition entry.

* FAT32                    0   1  1   747 254 63   12016557 [D DRIVE]
D Linux                 1023   1  1  1244 254 63    3566367

The user has choose to only recover the FAT32 partition. After a backup of its data, he has shrink the FAT32 filesystem to use one sector less. It's now time to recover the second partition. The user has manually add the second partition entry.

 1 * FAT32                    0   1  1   746 254 63   12000492 [D DRIVE]
 2 E extended LBA           747   0  1  1244 254 63    8000370
 5 L FAT32                  747   1  1  1244 254 63    8000307

In Advanced, select the second FAT32 and RebuildBS. After a reboot and a little filesystem check, data were again available.

Recovery of cdrom session

With multi-session cdrom, it is possible to delete files of previous session. Because the files are not really deleted, it is possible to recover them. To read files from the first session, run under Linux

mount /dev/cdrom /mnt/cdrom -t iso9660  -o session=0

Recovery of reformated partition

If the partition has been reformated to another filesystem (FAT32 formated as NTFS or vice-versa),

  • run TestDisk,
  • select the harddisk, the partition type
  • choose Advanced
  • select the partition
  • choose Type,
  • enter the value corresponding to the previous filesystem
  • choose Boot
  • choose RebuildBS
  • List
  • If you can see your files, choose Write and confirm
  • In Analyse, choose to rewrite the partition with the correct partition type.

Return to TestDisk main page