Principle of FAT file system 4

 

★ FAT16 storage principle:   

    When a portion of the disk space the file system is formatted as fat, fat file system partition will be assigned as a regional block plan to store in the data. In general, divided form in Figure 7. We extracted the FAT16 part, describe in detail: 
    FAT16 is a file system that Microsoft introduced earlier, with a high degree of compatibility and is still widely used in personal computers, especially mobile storage devices, FAT16 simple terms by the Fig 4.3.11 6 shows the integral part of (mainly former Part 5). Boot sector (DBR) as we have said, FAT16 does not leave any after DBR reserved sectors, is subsequently followed by the FAT table. FAT16 FAT table is used to record the data area of the disk cluster chain structure. Like the previous example, like we said, FAT disk space by a certain number of sectors be divided into units, such units called clusters. Typically, the principle of 512 bytes per sector is constant. The cluster size is generally 2 N  (N is an integer) the size of a sector, such as 512B, 1K, 2K, 4K, 8K, 16K, 32K, 64K. In practice usually not more than 32K. The reason why the cluster as a unit rather than in sectors allocated disk partition because when larger capacity, the use of size 512b sector management will increase the number of fat tables, large file access increased consumption, File system efficiency is not high. The size of the partition and cluster values ​​are related, as shown in Table 9  

 

Figure 4.3.11 Fat16 of organizational forms
Boot sector FAT1 FAT2 (repeated) Root folder All other folders and files The remaining sectors
1 Sector Take the size of the actual situation With FAT1 32 sectors Starting cluster number (from 2 starts) Inadequate cluster

 

 

 

Table 9 FAT16 partition size and cluster size on the result
Partition space Each cluster of sectors Cluster space
0MB-32MB 1 512 Bytes
33MB-64MB 2 1k
65MB-128MB 4 2k
129MB-225MB 8 4k
256MB-511MB 16 8k
512MB-1023MB 32 16k
1024MB-2047MB 64 32k
2048MB-4095MB 128 64k

 


    Note: Less than 32,680 partition sectors, the cluster size of the space of each cluster can reach a maximum of eight sectors. Whether the user is using the Disk Manager to format the partition, or use the command prompt, type FORMAT command to format, formatting program creates a 12-bit FAT. Less than 16MB partition, the system will usually formatted into 12-bit FAT, FAT12 format is FAT initial implementation is for small medium. FAT12 and FAT16 file allocation table than FAT32 file allocation table is small, because it is less space used for each entry. This leaves more space for data. All with a FAT12 formatted 5.25-inch floppy and 3.5-inch 1.44MB floppy disks are made FAT12 formatted. Apart from the different FAT table records the number of bits per cluster chain with FAT16, the rest are the same principles and FAT16, not explained separately. . .

    FAT16 formatted partition, formatted according to the size of the partition of the program to determine the size of the cluster, and then to determine the number of reserved sectors, the number of sectors the root directory, the data area can be divided into a number of clusters and the space occupied by FAT FAT table itself The number of sectors required for the table, and then writes the results to calculate the relative position after the DBR. 
    FAT16 DBR at offset 0x11 parameter counts the number of sectors occupied by the root. Offset 0x16 FAT table records the data occupied sector. Record the number of copies of the offset 0x10 FAT table. Several parameters of the system obtained after this, it can determine the start sector of the data area is shifted. 
    FAT16 file system root of the first sector from the proportion of 32 sectors in the cluster is started after the data processing unit, in units of sectors still before. For the first cluster after the root system does not numbered 0 1 cluster or clusters (which may be reserved for key reason for it), but the number for the first two clusters, ie the data area on the order of The first one is the first two clusters on the cluster number. 
    FAT file system is the reason why there are different versions of the points 12,16,32, which lies in the FAT table is used to record a bunch of links to any number of bits. With FAT16, for example, each cluster occupies 2 bytes (binary 16) in the FAT table. Therefore, the cluster number FAT16 maximum that can be represented as 0xFFFF (decimal 65535) to 32K for the size of the cluster, then, FAT32 maximum disk space that can be managed as: 32KB × 65535 = 2048MB, which is why FAT16 does not support more than 2GB partition reasons. 
    FAT table is actually a data table to two bytes, we tentatively called FAT entries this unit, normally one of its first and second entries (first 4 bytes) is used as the medium is described. From the beginning of the third record entries recorded cluster chain case files and other directories outside of the root folder. FAT clusters based on their performance conditions with the appropriate value to describe, as shown in Table 10

 

Table 10 FAT16 entries meaning of values ​​(hexadecimal)
The value of FAT16 entries Corresponding cluster performance conditions
0000 Unallocated clusters
0002 ~ FFEF Assigned cluster
FFF0 ~ FFF6 Reserved
FFF7 Bad clusters
FFF8 ~ FFFF End of file clusters

 

     See a cut in winhex the FAT16 file allocation table, Figure 10:

   

   As shown, FAT table at the beginning of "F8 FF FF FF" to, 2 bytes for the media described this unit is not involved in the FAT table cluster chain relationships. Red word mark is a 2-byte sectors per FAT corresponding cluster number. 
   Relative offset of the offset 0x4 ~ 0x5 cluster 2 (the first order of one cluster), here FF, which means that the file (directory) is stored in the second cluster is a small file, it occupies only one end of the cluster. 
   3 data is stored in the cluster 0x0005, which is a file or folder first cluster. Its content is the fifth cluster, cluster that is located next 5 clusters -> FAT table to guide us to reach the first five clusters pointing FAT table, write the above data is "FF FF", which means that this file has to end clusters. 
   4 data is stored in the cluster 0x0006, which in turn is a file or folder first cluster. Its content is the sixth cluster, cluster that is located next 6 clusters -> FAT table to guide us to reach the first six clusters pointing FAT table, write the above data is 0x0007, the next cluster that is located on the 7th cluster -> FAT table to guide us to reach the first seven points to cluster FAT table ...... read until FAT chain based on the relative sector offset 0x1A ~ 0x1B, which is the first 13 clusters, wrote the above data is 0x000E, which is pointing to the first Cluster 14 -> 14 cluster content "FF FF", which means to the end of this document has been clustered. 
    Behind the FAT table data the same reason as above. No analysis.

    FAT table records storage disk data file list, for the purpose of reading data is extremely important that Microsoft developed its FAT file system to create a backup FAT table, what we see FAT2. Content FAT2 FAT1 usually with real-time synchronization, which means that if the reader through the normal system of FAT1 made ​​changes, then FAT2 also been updated. If from this point of view, this system functions in data recovery when a natural disaster.

    FAT file system directory structure is actually a directed from the root to the leaf of the tree, there is to be mentioned here refers to any FAT partition files (including folders), are required to be addressed from the root directory found. Can be considered: the entrance is the root directory of the storage structure. 
    According to the root directory of the FAT file system to address other files (including folders), and therefore the position of the root disk must be determined prior to accessing data. The FAT file system is already calculated according to the FAT table (2 parts) DBR parameters related to the size of the partition stored in DBR determined. After formatting, with the size and location of the directory in fact have been determined: the position immediately after the FAT2, size is usually 32 sectors. After the root directory of the data area is the second cluster. 
    FAT file system is an important idea is that the directory (folder) as a special file handling, FAT32 or even the root directory as a file handle (next: NTFS partition parameters, security permissions for the file, such as a lot of things more abstract This idea of sublimation), in FAT16, although the position is not equivalent to the root directory of the file or the common directory, but its form of organization and general directories (folders) is no different. FAT partition all the folders (directories) files, can actually be seen as a store other files (folder) entry parameter data table. So the size of the directory space is not equal to its size under all the data, but not equal to 0. Usually account for a small space, can be seen as the directory file is a simple two-dimensional table file. The specific storage principle is: 
    No matter how much space is occupied by the file directory cluster, a cluster is the number of bytes. The system will be in 32-byte directory file share clusters assigned to the unit. This 32-byte to determine the offset to define a file (or folder) in this catalog under the property, is actually a simple two-dimensional tables. 
    This is the byte offset of 32 bytes as defined in Table 11:

 

The table below shows the definition of 11 FAT16 32-byte directory entry
Byte offset (hexadecimal) Byte count Definitions
0x0 ~ 0x7 8 File Name
0x8 ~ 0xA 3 Extension
0xB 1 Attribute byte 00000000 (reading and writing)
00000001 (Read Only)
00000010 (hide)
00000100 (System)
00001000 (label)
  00010000 (subdirectories)
00100000 (archive)
0xC ~ 0x15 10 Reserved
0x16 ~ 0x17 2 Recent file modification time
0x18 ~ 0x19 2 Last modified date of the file
0x1A ~ 0x1B 2 Said first cluster file
0x1C ~ 0x1F 4 Length indicates the file

 

    
  

 
Domain name: www.mrtlab.com | | Telephone: +86-27-82621261
MRT data recovery website,provides professional HDD firmware repair and data recovery technical resources!
Copyright 2003-2014 Powered By MrtLab