FAT12

FAT12 is one of FAT file system families,mostly used on 1.44MB floppy disk。

FAT 's full name is File Allocation System

 

FAT12 has 4 key parts as follows:

  1. boot sector
  2. FAT tables
  3. root directory entry
  4. data area

 

 

Boot sector:

Store data and code that necessary for OS or other users to use it. The data is BPB, BIOS Parameter Block。

regularly, BPB take 25 Bytes, some attributes :

As you can see, in fat12, it has 512 Bytes every sector, and a cluster has ONLY one sector.

 

And you can write your program into the code area of boot , for example, you can use it to create you OS with a tool--Bochs.

 

FAT tables:

  FAT tables is very important.

  It take Sector 1 to Sector 18, 18 sectors totally. And it's has two copies,--FAT1, FAT2

  it was splited into little entries. Every entry has 12 bits. 

  Why 12 bits, because 1.44MB floppy need 12 bits to address: 2^11< 1.44MB < 2^12

  every 12-bit entry is one-to-one-correspondence to a cluster in data area.  So it just like contents of books, which can locate to the chapters.

 

  12 bits means a value, it has special meaning:

 

 

 

 

 

 

 

Root Directory Entry:

  A file system must has root, FAT12 has root directories.

  We know that there are two types things in a file system: 1. File, 2. Directory

  So how to express and store them???

 

  In FAT12, every directory has a sector to store it's sub-directories or files. As for the sector, if it's root directory or file(parallel to the root dir), it's stored in Root Dorectory Area. Others are stored in data area.

  enery Dir or file has a entry, which is 32 bytes:

 

 

 

 

   so: a dir has 16 sub-dir or files at most. 

  Where is the cluster of sub-dir?

    A entry has attr "First Logicial Cluster", which point to the next cluster. As for a dir , it's cluster No of  it's entries of sub-files, sub-dir. As for File, if it's size < 512Bytes, over. if not ,it has another cluster, and the logical cluster points to it.

    (Note: A file take integer clusters)

 

Data Area:

  The main area of data, store file/dir entries and file data.

 

 

 

to sum up:

  Starting from the root directory of the file system, each directory / file has an entry, the relevant information is stored, wherein the presence of the root of the root directory entry region / root files, and other common data area exists.

  For each entry, representing 32, wherein there is a first FLC FLC logical cluster number, pointing to another cluster directory, which files and subdirectories stored entry, a directory and subdirectories up to 16 files. GLC file pointed to each of the clusters storing the content file, if the file is larger than 512 bytes, the other storage needs, the next cluster number taken to the next cluster can be relocated to the FAT table with the current cluster number.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/XT-xutao/p/11854448.html