Micro Firmware Tech Support

Notes on Cluster Size or Allocation Unit Size


Filename: CLUSTER.TXT
WWW URL:  http://www.firmware.com/support/bios/cluster.htm
FTP URL:  ftp://ftp.firmware.com/text/cluster.txt
Revision: 11/19/96  TLS  Micro Firmware Technical Support
Summary:  Discussion of cluster (allocation unit) size and wasted
          space on hard drives. Includes table of partition sizes
          and cluster sizes.

Usually it is simplest to just partition a drive with one partition using the full capacity of the drive. However, the size of the partition has an effect on storage efficiency and it may be appropriate to consider this before partitioning a hard drive, especially a larger drive. Many people decide to partition a hard drive into two or more logical drives to reduce the amount of wasted space on the drive.

Hard drives and floppy disks formatted under DOS are divided into sectors during the format process. Each sector can store 512 bytes of data. This is the smallest unit that DOS uses when reading or writing to or from a hard drive or floppy disk.

All data used by a PC is in the form of files. Although the sector is the smallest unit that DOS deals with when transferring data to and from a drive, the cluster, or allocation unit, is the smallest unit that DOS can use when allocating space to store a file. The size of the allocation unit varies from drive to drive depending on the size of the logical drive. (Allocation unit is a newer term, cluster is older - they are interchangeable - both are in wide use.)

DOS uses a file system known as the FAT (File Allocation Table) system. Entries are made in the FAT table to keep track of the location of files on the drive. Each entry can point to only one file, though a file may have any number of entries, depending on the size of the file. Each FAT entry is limited to 16 bits. This limits the number of different possible FAT entries (and allocation units) to 65,536. When a drive is formatted, the FORMAT command selects the smallest cluster size that it can, based on the size of the drive. Here is a chart showing drive sizes and allocation unit sizes:


Allocation unit FAT
HD Volume size or cluster size Type
in Megabytes bytes Kilobytes

0 - 15 4096 4KB (8 sectors) 12-bit
16 - 127 2048 2KB (4 sectors) 16-bit
128 - 255 4096 4KB (8 sectors) 16-bit
256 - 511 8192 8KB (16 sectors) 16-bit
512 - 1023 16384 16KB (32 sectors) 16-bit
1024 - 2047 32768 32KB (64 sectors) 16-bit


(Volume sizes are in binary megabytes as used by FDISK)

Since a file must occupy at least one whole cluster and no cluster can be used by more than one file, there is always some wasted space on every drive. The amount of wasted space in a cluster is called cluster overhang or slack space. The total amount of wasted space on a drive depends on the cluster size, the number of files, and the size of the files. The approximate total slack space can be calculated as 1/2 cluster size times the number of files.

Some examples - A file with a size of 3072 bytes would use two 2K allocation units on a 120MB drive. The first allocation unit would be filled entirely and the next would be half full, with 1024 bytes wasted. The same file on a 250MB drive would use one 4K cluster and would also waste 1024 bytes. The same file on a 1GB drive would use one 32K cluster with 29,696 bytes wasted. A larger file will waste a much smaller relative amount of drive space. A file with a size of 1,000,000 bytes on a 500MB drive would fill 122 8K clusters and part of another cluster with 476 bytes wasted. Note that the larger the average file size, the less need there is to use a smaller cluster size.

Many people are surprised when they attempt to copy the contents of a 250MB drive onto a 300MB drive and find that the contents of the smaller drive may not fit on the larger drive. This is due to the change in the allocation unit size.

The issues described above are entirely due to the design of the FAT file system used by MS-DOS. None of the resulting limitations have anything to do with the system BIOS. Note that WIN95 uses a slightly different file system known as VFAT but all of the above limitations also apply to the VFAT system. VFAT differs from FAT mainly in its ability to use long filenames. Other operating systems, present and future, may use different types of file systems and the same hard drive on the same system with the same BIOS may be able to hold a different amount of files. Windows NT uses its own NTFS file system. OS/2 uses its own HPFS file system but can also use the FAT system.

Note that the only way to change the size of the allocation unit on a particular drive is to repartition the drive, which results in the loss of all data on the drive.

Also, the issue of wasted space discussed here has nothing to do with file "fragmentation". This condition exists when many files are occupying non-contiguous allocation units. This occurs normally as files are deleted, leaving "holes", and new files are copied onto the drive, with DOS filling in empty allocation units starting at the beginning of the drive. This condition can slow down performance if it has reached an advanced stage. The condition is corrected by running a program such as DEFRAG (supplied with MS-DOS 6.x) or SPEEDISK from Norton Utilities or just by copying everything off of the drive, formatting or erasing it, and copying everything back on. Actually it may not be correct to say that cluster size has nothing to do with file fragmentation, since smaller cluster sizes may favor increased fragmentation.

The subject of this file is discussed in detail in an article in PC Magazine:

"Drive Size vs. Storage Efficiency" - TUTOR Column by Jeff Prosise, PC Magazine Vol. 14, No. 12 June 27, 1995 pages 249-253.


SALES - SUPPORT - CONTACT - LINKS - HOME


Micro Firmware, Inc.
330 W. Gray Street
Norman, Oklahoma 73069-7111
Toll-Free Sales (USA/Canada): 1-800-767-5465 or 1-888-4-PC-BIOS
Support & Sales: +1 405-321-8333
Sales Department FAX: +1 405-573-5535
Technical Support FAX: +1 405-321-8342
Email: sales@firmware.com support@firmware.com

© 1998 Micro Firmware, Inc. - All Rights Reserved
While every attempt is made to ensure the accuracy of our support documents, Micro Firmware provides these documents on an AS-IS basis for information purposes only.