Summary of FAT file system 2

 

About FAT boot sector is also important explanation, we assume that the contents inside are sorted by byte, then the sector [510] The content must 0x55, sector [511] The content must be 0xAA FAT-owned lot number of documents will 0xAA55 said to be "the last two bytes of the boot sector contents," this argument is correct, but only applies to BPB_BytsPerSec is 512 cases. If the value is greater than 512 BPB_BytsSec the position of the mark has not changed, although in the last two bytes of the boot sector write 0xAA55 no problem. 

Five, FAT type recognition 
 
FAT word type (FAT12/16/32) can only be determined through a FAT volume cluster (Cluster) number, there is no other way.
 
Cluster 总数的计算:RootDirSectors = (BPB_RootEntCnt*32) /BPB_BytsPerSec DataSect = TotSec – (BPB_RsvdSecCnt +(BPB_NumFATs * FATSz) + RootDirSectors) CountofClusters = DataSec / BPB_SecPerClus
 
If (CountofClusters <4085) {/ * volume type is FAT12 * /
} Else if (CountofClusters <65525) {/ * volume type is FAT16 * /
} else { 
/ * Volume type is FAT32 * / 
}
 
Note that the number (count of Cluster) cluster is the number of clusters share data area (the count of the data cluster), counting from the cluster 2, while the "maximum number of clusters available" (Maximun valid cluster number for the volume) is CountofClusters +1, "including the number of clusters to retain clusters" (count of cluster including the two reserved cluster) was CountofClusters +2. Sector root of the number of occupied: RootDirSectors = (BPB_RootEntCnt * 32) / BPB_BytsPerSec data area (Cluster 2) start Sector: FirstDataSector = BPB_EsvdSecCnt  +    (BPB_NumFATs * FATSz)   +     RootDirSectors to a legitimate cluster number N, the first cluster A sector number calculated by the following formula: FirstSectorofCluster = ((N -2) * BPB_SecPerClust) + FirstDataSecot; because BPB_SecPerClus always an exact power of 2, this means BPB_SecPerSlus multiplication may be performed by the mobile. 
 
NOTE : This is where the said the Sector Number, refers for the package volume BPB first sector ( DBR ) offset ( DBR Set Sector 0 ).

Six, FAT calculate the position of each part 

Summary of FAT file system 2

DBR_Base: offset address 8Bytes read 4Bytes from DPT data can be directly seen Sector DBR resides. RsvSectors = BPB_RsvdSecCnt. FAT_Base = DBR_Base + RsvSectors FATSize = BPB_NumFATs * FATSz which, FATSz = (FAT32?) BPB_FATSz32: BPB_FATSz16 Root_Base: If FAT12/FAT16, then Root_Base = FAT_Base + FATSize If it is FAT32, then Root_Base = BPB_RootClus RootSize: If it is FAT32, then There is no limit; otherwise RootSize = (BPB_RootEntCnt * 32) / BPB_BytsPerSec Data_Base: Only for FAT12/FAT16, Data_Base = Root_Base + RootSize
 
Domain name: www.mrtlab.com | | Telephone: +86-27-82621261 | Terms of use
MRT data recovery website,provides professional HDD firmware repair and data recovery technical resources!
Copyright 2003-2019 Powered By MrtLab