Re: comprehensive info regarding FAT32, books and web
Posted: Mon Jun 27, 2016 2:43 am
Octocontrabass wrote:The number of reserved sectors varies depending on the tool used to format the disk. Most tools provide only 32 reserved sectors (this number includes the boot sector, fsinfo sector, and backup boot sector).ggodw000 wrote:I see large No. of sectors available. [...] It looks like a convenient place to put large bootloader related code.
Microsoft's FAT32 bootloaders use 2 sectors in total: the boot sector and one additional reserved sector. If you need more than that, you should probably store the rest of your bootloader as a file on the disk.
that would defeat the purpose of writing bootloader. Part of the bootloader i am writing is for loading the file from full-fledged fat-32 partition.you should probably store the rest of your bootloader as a file on the disk.
from ~-s post: FAT32 Specification (https://staff.washington.edu/dittrich/m ... gen103.pdf)
it appears sector 6 of reserved region is used for boot loader recovery based on the section titled "FAT32 FSInfo Sector Structure and Backup Boot Sector ":
here is the excerpt:
"Another feature on FAT32 volumes that is not present on FAT16/FAT12 is the BPB_BkBootSec field.
FAT16/FAT12 volumes can be totally lost if the contents of sector 0 of the volume are overwritten or
sector 0 goes bad and cannot be read. This is a “single point of failure” for FAT16 and FAT12
volumes. The BPB_BkBootSec field reduces the severity of this problem for FAT32 volumes, because
starting at that sector number on the volume—6—there is a backup copy of the boot sector
information including the volume’s BPB.
In the case where the sector 0 information has been accidentally overwritten, all a disk repair utility
has to do is restore the boot sector(s) from the backup copy. In the case where sector 0 goes bad, this
allows the volume to be mounted so that the user can access data before replacing the disk.
This second case—sector 0 goes bad—is the reason why no value other than 6 should ever be placed
in the BPB_BkBootSec field. If sector 0 is unreadable, various operating systems are “hard wired” to
check for backup boot sector(s) starting at sector 6 of the FAT32 volume. Note that starting at the
BPB_BkBootSec sector is a
complete
boot record. The Microsoft FAT32 “boot sector” is actually
three 512-byte sectors long. There is a copy of all three of these sectors starting at the
BPB_BkBootSec sector. A copy of the FSInfo sector is also there, even though the BPB_FSInfo field
in this backup boot sector is set to the same value as is stored in the sector 0 BPB.
NOTE:
All 3 of these sectors have the 0xAA55 signature in sector offsets 510 and 511, just like the
first boot sector does (see the earlier discussion at the end of the BPB structure description). "