FAT32 Study Notes (1)

Source: Internet
Author: User

1. Basic Concepts

FAT32 spec
The full name of fat is File Allocation Table. Fat was developed by Microsoft in the 1980s, mainly including fat12, fat16, and FAT32, there are 12 bits in fat12 fat entry, 16 bits in fat16, and 32bit in FAT32 fat entry.

 

2, fat format

The size of a single sector (sector) is 512 bytes. The size of a cluster is usually the number of clusters of the integer power of 2. the maximum size is 32 KB. A file occupies at least one cluster, it is usually an integer cluster, which is linked to each other.

FAT32 format (data is calculated from the cluster and does not contain cluster0 or cluster1 .)

 

MBR

Boot

Fsinfo

CLR

Fat1

Fat2

Data

 

 

Fat16 format (data starts with cluster2)

 

MBR

Boot

CLR

Fat1

Fat2

Rotdir

Data

 

 

Boot refers to the boot sector. The boot sector occupies the first logical sector and the size is bytes. For detailed explanations of the boot sector, refer to FAT32 spec. The main useful members are as follows:

 

Name

Offset (byte)

Size (byte)

Description

Bpb_bytspersec

11

2

Description of the number of bytes for each sector, usually 512 (Forward compatible). The value can also be 4096,

Note: If the physical sector of a device is N and N is greater than 512, the value is N but cannot exceed 4096.

Bpb_secperclus

13

1

Indicates the number of sector s in each cluster, which is usually an integer power of 2, but a cluster generally does not exceed 32 K.

Bpb_rsvdseccnt

14

2

Retain the number of sector in reserved region. For fat12 fat16, this value is 1, for FAT32, this value is 32.

Bpb_numfats

16

1

The number of fat data structures, usually 2, fat1, and fat2. Security is mutually backed up.

Bpb_rootentcnt

17

2

For FAT32, this value is 0. For fat12 and fat16, this value indicates the number of entries in the 32byte root directory.

Bpb_totsec16

19

2

For fat12 and fat16, this value indicates the number of sector in fatimg. For FAT32, this value is 0, the number of sector in fatimg is expressed in the range of offset 32 length 4.

Bpb_media

21

1

0xf8 indicates non-removable media, and 0xf0 indicates removable media. The value must be the same as the low position of fat [0 ].

Bpb_fatsz16

22

2

For fat12 and fat16, it indicates that a fat occupies the sector size. For FAT32, this value is 0.

Bpb_hiddsec

28

4

For devices without partitions, this value is 0. For other devices, this value indicates the number of hidden sector before partition.

Bpb_totsec32

32

4

FAT32 indicates the total number of devices. Does not contain the MBR

 

 

 

The following is for FAT32.

Name

Offset (byte)

Size (byte)

Description

Bpb_fatsz32

36

4

The number of sector occupied by a fat table. FAT32 has two fat tables that are mutually backed up. fat12 and fat16 are empty.

Bpb_extflags

40

2

When bit7 is 0, fat table 1 and fat Table 2 are mirrored to each other during running. If bit7 is 1, only one fat table is active during running, fat12 and fat16 are empty.

Bpb_rootclus

44

4

The serial number of the cluster where the root directory is located, usually 2, that is, the second cluster of Data region is the root directory, in this way, you can easily find the root directory from cluster2 (I personally understand that cluster starts from data Region)

Bpb_fsinfo

48

2

Indicates the number of sector occupied by fsinfo.

Bpb_bkbootsec

50

2

Number of Boot Sector backups in the reserved area.

Bpb_reserved

52

12

Future Extension

Bs_drvnum

64

1

 

Bs_filpolicype

82

8

FAT32 is usually set as the string "FAT32"

 

510

2

The fixed value is 0x55 AA. The fixed value offset must be at the 510 position and does not change with the sector.

 

FAT32 Study Notes (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.