Only for expert use in trying to recover and repair OS Boot sectors! If the FAT or NTFS boot sector is damaged, data can not be accessed. Windows will prompt "The drive is not formatted, do you want to format it now?" Linux mount will display "wrong fs type, bad option, bad superblock"
TestDisk let you manipulate the boot sector of FAT partitions. Select the partition you want to modify and choose Boot.
TestDisk 6.2-WIP, Data Recovery Utility, November 2005 Christophe GRENIER <grenier@cgsecurity.org> http://www.cgsecurity.org Disk /dev/sda - 120 GB / 111 GiB - CHS 14593 255 63 Partition Start End Size in sectors 1 * FAT32 0 1 1 1010 254 63 16241652 [NO NAME] 2 P Linux 1011 0 1 1023 254 63 208845 [/boot] 3 E extended LBA 1024 0 1 14592 254 63 217985985 5 L Linux RAID 1024 1 1 3573 254 63 40965687 [md0] X extended 3574 0 1 4210 254 63 10233405 6 L Linux RAID 3574 1 1 4210 254 63 10233342 [md1] X extended 4211 0 1 14592 254 63 166786830 7 L Linux 4211 1 1 14592 254 63 166786767 [ Type ] [ Boot ] [ Quit ] Boot sector recovery
If the boot sector and backup boot sector mismatches (FAT32), you can copy overwrite the backup boot sector with the boot sector or vice versa. You can also rebuild FAT boot sector, dump its content or repair FAT.
TestDisk 6.2-WIP, Data Recovery Utility, November 2005 Christophe GRENIER <grenier@cgsecurity.org> http://www.cgsecurity.org Disk /dev/sda - 120 GB / 111 GiB - CHS 14593 255 63 Partition Start End Size in sectors 1 * FAT32 0 1 1 1010 254 63 16241652 [NO NAME] Boot sector OK Backup boot sector OK Sectors are identical. [ Quit ] [Rebuild BS][ Dump ] [Repair FAT] Return to Advanced menu
To rebuild a FAT boot sector, TestDisk assumes that
The steps are
If FAT12 or FAT16 is found, assumes there is only one reserved sector. If it's the second FAT, deduce the the fat length. If beginning of FAT32 first fat is found at sector 32 or 33, deduce the number of reserved sectors.
assumes the first two are the two copies of the FAT. Deduce the number of reserved sectors and fat length.
use inode of "." directory entries to get the cluster size and deduce where the first cluster begin. From the number of cluster, deduce if it's a FAT12, FAT16 or FAT32. If FAT12 or FAT16, assume there is only one reserved sector. Try to find the number of directories entree (512 by default). Deduce the FAT length.
the user can also list the files of the FAT partition
To repair FAT, TestDisk compares the two FAT copies. If FAT mismatches (sector by sector check) or contains errors, it uses the FAT copy with less errors and remove the obvious errors. This function must only be used on FAT filesystem with correct values in the boot sector. It has been used with success when scandisk, chkdsk or fsck.vfat refused to repair the filesystem or crashes.
TestDisk let you manipulate the boot sector of NTFS partitions. Select the partition you want to modify and choose Boot. If the NTFS boot sector and backup boot sector mismatches, you can copy overwrite the backup boot sector with the boot sector or vice versa. You can also rebuild NTFS boot sector or dump the boot sector content. To rebuild NTFS boot sector, TestDisk try to locate the MFT (Master File Table: $MFT) and its backup ($MFTMirr). It reads the mft record size and it computes the cluster size, It reads the Size of Index Allocation Entry in the root directory index. Using all these values, it can provide a new boot sector. TestDisk lets the user list the files before writting.
If the EXT2/EXT3 primary superblock is damaged, Fsck doesn't always find its backups. To search them, select the partition and choose Superblock.
Back to Running the TestDisk Program