How to fix fake bad sectors (FAT32)

After using a chkdsk (check disk) in Windows 7 for the external USB HDD I obtained 0 free space. All 30Gb were gone.

Several repeatings of the procedure have done nothing, as well as fsck.vfat/msdos from Ubuntu LiveCD.  Acronis Disk Director didn’t recognize this USB HDD.

The last way is to fix it by using a hex editor:

1) Let’s find the MBR:

FATMBR

2) Next the first copy of FAT boot sector should be found. Here’s a description of the common part of the FAT12, FAT16 and FAT32 boot sectors:

Bytes| Content
0-2| Jump to bootstrap (E.g. eb 3c 90; on i86: JMP 003E NOP. One finds either eb xx 90, or e9 xx xx. The position of the bootstrap varies.)
3-10| OEM name/version (E.g. “IBM  3.3”, “IBM 20.0”, “MSDOS5.0”, “MSWIN4.0”. Various format utilities leave their own name, like “CH-FOR18”. Sometimes just garbage. Microsoft recommends “MSWIN4.1”.) /* BIOS Parameter Block starts here */
11-12| Number of bytes per sector (512) Must be one of 512, 1024, 2048, 4096.
13| Number of sectors per cluster (1) Must be one of 1, 2, 4, 8, 16, 32, 64, 128. A cluster should have at most 32768 bytes. In rare cases 65536 is OK.
14-15| Number of reserved sectors (1) FAT12 and FAT16 use 1. FAT32 uses 32.
16| Number of FAT copies (2)
17-18| Number of root directory entries (224) 0 for FAT32. 512 is recommended for FAT16.
19-20| Total number of sectors in the filesystem (2880) (in case the partition is not FAT32 and smaller than 32 MB)
21| Media descriptor type (f0: 1.4 MB floppy, f8: hard disk; see below)
22-23| Number of sectors per FAT (9) 0 for FAT32.
24-25| Number of sectors per track (12)
26-27| Number of heads (2, for a double-sided diskette)
28-29| Number of hidden sectors (0) Hidden sectors are sectors preceding the partition. /* BIOS Parameter Block ends here */
30-509| Bootstrap
510-511| Signature “55 aa”

FATBootSec

3) And finally, the first copy of File Allocation Table should start with Media Descriptor byte:

MediaDescByte

4) By replacing of all bad sectors (F7 FF FF 0F) with zeros the problem has been solved. (Replace only in the FIRST copy of FAT before the next Media Descriptor byte).

BadSec

Be care!

BadSecGone