Fox Y2K Logo
FAT System Guide
FOXy2K
Contents

Home

FAT System Guide

The DOS Zone

My Software

 

The Data Area

Use this information only if you agree to the terms in my Disclaimer

    The data area of a disk is where the contents of your files (and directories) are stored, it comes after the file system (boot sector, FAT's and sometimes the root directory) but need's to be understood before the other areas can be explained. You're probably thinking "Well how complicated can it be?" my answer would be "More than you think".

I'm about to introduce another term, the "cluster". A cluster is a group of sectors, for instance sectors 33, 34, 35, 36 could collectively be called cluster 2.
The important thing to realise is that a cluster is only used in the data area. The file system is stored in sectors, only the files (and directories) are stored in areas referred to as clusters.
If you run scandisk on a 1.44MB floppy disk you may have noticed that it goes through 33 sectors and then swaps to clusters, the file system is stored in those first sectors, when the data area is reached it checks the clusters. Now don't misinterpret this, I'm not saying that the sectors are physically replaced with clusters on the disk, I am saying that to read a single cluster, with 4 sectors per cluster, would require you to read in 4 separate sectors (e.g. 33,34,35 and 36).

The number of sectors per cluster is stored in the boot sector, to calculate the cluster size you multiply the number of sectors per cluster by the sector size.

So why are clusters necessary? To know that you need to know what 12,16 and 32 in FAT12, FAT16 and FAT32 means. It refers to the amount of space used to store each number used to reference a cluster (like a page number references a page). Computers generally use binary to count, 0's and 1's, whereas we use decimal 0,1,2,3,4,5,6,7,8 and 9.
0 and 1 gives two symbols the "0" and the "1", 0 to 9 gives ten, so we say that binary is base 2 and decimal is base 10. If you had three columns and were counting in decimal you could go from 0 to 999 (1000 different combinations including 0), to go any further would require a fourth column so you could reach 1000. There is a way of calculating the range, in the calculator that comes with Windows there is a button that looks like this: (you have to have it in scientific mode). If you have Windows run the calculator, or you can use any old scientific calculator if one is available, and try this:

  1. Enter 10 (for base 10 (decimal)).
  2. Press the button shown above.
  3. Enter 3 (the number of columns).
  4. Press the equals button.
You should get 1000, the number of different combinations possible. Now back to the point, the 12,16 and 32 refer to the number of columns used to store each number, but in binary not decimal. FAT 12 uses 12 bits (or columns if you prefer) this means that a number can go from 0 to 4095, 4096 combinations. If you wish to prove that then:
  1. Enter 2 (for base 2 (binary)).
  2. Press the button illustrated above.
  3. Enter 12 (the number of columns, bits technically).
  4. Press the equals button.

Now if we didn't have clusters that means that we'd be using sectors instead, since sectors are almost certainly going to be 512 bytes in size that means the maximum size of disk supported would be approximately 512*4096 or 2MB (it's actually smaller but I won't go in to why yet). That would be fine for a 1.44 3 1/2" floppy disk, in fact these use 1 sector per cluster, but FAT12 partitions can support up to 15MB disks, to do that requires clusters, a method of treating a number of sectors as one unit.
You should note that the larger the number of bits you use to store the cluster's address the smaller the cluster size you need to have.

So why not just use the number of bits required to give you a 1 sector cluster?
Well you'd require more space for the file system to be stored, a lot more space in fact.

What is the problem with a large cluster size?
When a file is stored it's broken up into cluster sized pieces, each cluster can only be used to hold part of one file the rest of the space is wasted, so a larger cluster size means more possible waste per file. As an example, a one byte file stored on a disk which has a cluster size of 4KB will mean the loss of about 3.999KB, these losses do add up quickly.

Well that's it for this section, if you're still reading then well done. If you're aren't then I can pretty much type whatever I want about you and you'll never know.

Go Back To Previous Section.Procede To Next Section.
Copyright © Jonathan Fox 2000-2002.