almanach interfacing disk drives

DOS uses a combination of disk management components to make files accessible. These components differ slightly between floppies and hard disks and between disks of different sizes. They determine how a disk appears to DOS and to applications software. Each component used to describe the disk system fits as a layer into the complete system. Each layer communicates with the layer above and below it. When all the components work together, an application can access the disk to find and store data. Table 22.1 lists the DOS format specifications for floppy disks.

Floppy Disk Format Specifications
Disk Size (in.)
Disk Capacity (K)
3 1/2"
2,880
3 1/2"
1,440
Media Descriptor Byte F0h F0h
Sides (Heads) 2 2
Tracks per side 80 80
Sectors per track 36 18
Bytes per sector 512 512
Sectors per cluster 2 1
FAT length (Sectors) 9 9
Number of FATs 2 2
Root Dir. Length (Sectors) 15 14
Maximum Root Entries 240 224
Total sectors per disk 5,760 2,880
Total available sectors 5,726 2,847
Total available clusters 2,863 2,847
The four primary layers of interface between an application program running on a system and any disks attached to the system consist of software routines that can perform various functions, usually to communicate with the adjacent layers. These layers are shown in the following list:

- DOS Interrupt 21h (Int 21h) routines
- DOS Interrupt 25/26h (Int 25/26h) routines
- ROM BIOS disk Interrupt 13h (Int 13h) routines
- Disk controller I/O port commands

Each layer accepts various commands, performs different functions, and generates results. These interfaces are available for both floppy disk drives and hard disks, although the floppy disk and hard disk Int 13h routines differ widely. The floppy disk controllers and hard disk controllers are very different as well, but all the layers perform the same functions for both floppy disks and hard disks.

Interrupt 21h
The DOS Int 21h routines exist at the highest level and provide the most functionality with the least amount of work. For example, if an application program needs to create a subdirectory on a disk, it can call Int 21h, Function 39h. This function performs all operations necessary to create the subdirectory, including updating the appropriate directory and FAT sectors. The only information this function needs is the name of the subdirectory to create. DOS Int 21h would do much more work by using one of the lower-level access methods to create a subdirectory. Most applications access the disk through this level of interface.

Interrupt 25h and 26h
The DOS Int 25h and Int 26h routines provide much lower-level access to the disk than the Int 21h routines. Int 25h reads only specified sectors from a disk, and Int 26h only writes specified sectors to a disk. If you were to write a program that used these functions to create a subdirectory on a disk, the amount of work would be much greater than that required by the Int 21h method. For example, your program would have to perform all of these tasks:

- Calculate exactly which directory and FAT sectors need to be updated.
- Use Int 25h to read these sectors.
- Modify the sectors appropriately to contain the new subdirectory information.
- Use Int 26h to write the sectors back out.

The number of steps would be even greater considering the difficulty in determining exactly what sectors have to be modified. According to Int 25/26h, the entire DOS- addressable area of the disk consists of sectors numbered sequentially from 0. A program designed to access the disk using Int 25h and Int 26h must know the location of everything by this sector number. A program designed this way might have to be modified to handle disks with different numbers of sectors or different directory and FAT sizes and locations. Because of all the overhead required to get the job done, most programmers would not choose to access the disk in this manner, and instead would use the higher-level Int 21h which does all the work automatically.

Only disk- and sector-editing programs typically access a disk drive at the Int 25h and Int 26h level. Programs that work at this level of access can edit only areas of a disk that have been defined to DOS as a logical volume (drive letter). For example, DEBUG can read sectors from and write sectors to disks with this level of access.

Interrupt 13h
The next lower level of communications with drives, the ROM BIOS Int 13h routines, usually are found in ROM chips on the motherboard or on an adapter card in a slot. However, an Int 13h handler also can be implemented by using a device driver loaded at boot time. Because DOS requires Int 13h access to boot from a drive (and a device driver cannot be loaded until after boot-up), only drives with ROM BIOS-based Int 13h support can become bootable. Int 13h routines need to talk directly to the controller using the I/O ports on the controller. Therefore, the Int 13h code is very controller-specific. The following table lists the different functions available at the Interrupt 13h BIOS interface. Some functions are available to floppy drives or hard drives only, whereas others are available to both types of drives.

Int 13h BIOS Disk Functions
Function Floppy Disk Hard Disk Description
00h X X Reset disk system
01h X X Get status of last operation
02h X X Read sectors
03h X X Write sectors
04h X X Verify sectors
05h X X Format track
06h X Format bad track
07h X Format drive
08h X X Read drive parameters
09h X Initialize drive characteristics
0Ah X Read long
0Bh X Write long
0Ch X Seek
0Dh X Alternate hard disk reset
0Eh X Read sector buffer
0Fh X Write sector buffer
10h X Test for drive ready
11h X Recalibrate drive
12h X Controller RAM diagnostic
13h X Controller drive diagnostic
14h X Controller internal diagnostic
15h X X Get disk type
16h X Get floppy disk change status
17h X Set floppy disk type for format
18h X Set media type for format
19h X Park hard disk heads
1Ah X ESDI - Low-level format
1Bh X ESDI - Get manufacturing header
1Ch X ESDI - Get configuration
Next table shows the error codes that may be returned by the BIOS INT 13h routines. In some cases, you may see these codes referred to when running a low-level format program, disk editor, or other program that can directly access a disk drive through the BIOS.

BIOS INT 13h Error Codes
Code Description Code Description
00h No error 06h Media change error
01h Bad command 07h Initialization failed
02h Address mark not found 09h Cross 64K DMA boundary
03h Write protect 0Ah Bad sector flag detected
04h Request sector not found 0Bh Bad track flag detected
05h Reset failed 10h Bad ECC on disk read
11h ECC corrected data error BBh Undefined error
20h Controller has failed CCh Write fault
40h Seek operation failed 0Eh Register error
80h Drive failed to respond FFh Sense operation failed
AAh Drive not ready
If you design your own custom disk controller device, you need to write an IBM-compatible Int 13h handler package and install it on the card using a ROM BIOS that will be linked into the system at boot time. To use Int 13h routines, a program must use exact cylinder, head, and sector coordinates to specify sectors to read and write. Accordingly, any program designed to work at this level must be intimately familiar with the parameters of the specific disk on the system on which it is designed to run. Int 13h functions exist to read the disk parameters, format tracks, read and write sectors, park heads, and reset the drive.
A low-level format program for ST-506/412 drives needs to work with disks at the Int 13h level or lower. Most ST-506/412 controller format programs work with access at the Int 13h level because virtually any operation a format program needs is available through the Int 13h interface. This is not true, however, for other types of controllers (such as IDE, SCSI, or ESDI), for which defect mapping and other operations differ considerably from the ST-506/412 types. Controllers that must perform special operations during a low-level format, such as defining disk parameters to override the motherboard ROM BIOS drive tables, would not work with any formatter that used only the standard Int 13h interface.
For these reasons, most controllers require a custom formatter designed to bypass the Int 13h interface. Most general-purpose, low-level reformat programs that perform a non-destructive format access the controller through the Int 13h interface (rather than going direct) and therefore cannot be used for an initial low-level format; the initial low-level format must be done by a controller-specific utility.
Few high-powered disk utility programs, other than some basic formatting software, can talk to the disk at the Int 13h level. The DOS FDISK program communicates at the Int 13h level. The Norton DISKEDIT and older NU programs can communicate with a disk at the Int 13h level when these programs are in their absolute sector mode; they are some of the few disk-repair utilities that can do so. These programs are important because they can be used for the worst data recovery situations, in which the partition tables have been corrupted. Because the partition tables, as well as any non-DOS partitions, exist outside the area of a disk that is defined by DOS, only programs that work at the Int 13h level can access them. Most utility programs for data recovery work only at the DOS Int 25/26h level, which makes them useless for accessing areas of a disk outside of DOS' domain.

Disk Controller I/O Port Commands
In the lowest level of interface, programs talk directly to the disk controller in the controller's own specific native language. To do this, a program must send controller commands through the I/O ports to which the controller responds. These commands are specific to the particular controller and sometimes differ even among controllers of the same type, such as different ESDI controllers. The ROM BIOS in the system must be designed specifically for the controller because the ROM BIOS talks to the controller at this I/O port level. Most low-level format programs also need to talk to the controller directly because the higher-level Int 13h interface does not provide enough specific features for many of the custom ST-506/412 or ESDI and SCSI controllers on the market.
Most application programs work through the Int 21h interface, which passes commands to the ROM BIOS as Int 13h commands; these commands then are converted into direct controller commands by the ROM BIOS. The controller executes the commands and returns the results through the layers until the desired information reaches the application. This process enables developers to write applications without worrying about such low-level system details, instead leaving them up to DOS and the ROM BIOS. This also enables applications to run on widely different types of hardware, as long as the correct ROM BIOS and DOS support is in place.
Any software can bypass any level of interface and communicate with the level below it, but doing so requires much more work. The lowest level of interface available is direct communication with the controller using I/O port commands. Each different type of controller has different I/O port locations as well as differences among the commands presented at the various ports, and only the controller can talk directly to the disk drive.
If not for the ROM BIOS Int 13h interface, a unique DOS would have to be written for each available type of hard and floppy disk drive. Instead, DOS communicates with the ROM BIOS using standard Int 13h function calls translated by the Int 13h interface into commands for the specific hardware. Because of the standard ROM BIOS interface, DOS can be written relatively independently of specific disk hardware and can support many different types of drives and controllers.

DOS Structures
To manage files on a disk and enable all application programs to see a consistent disk interface no matter what type of disk is used, DOS uses several structures. The following list shows all the structures and areas that DOS defines and uses to manage a disk, in roughly the same order that they appear:
- Master and extended partition boot sectors
- DOS volume boot sector
- Root directory
- File allocation tables (FAT)
- Clusters (allocation units)
- Data area
- Diagnostic read-and-write cylinder

A hard disk has all of these DOS disk-management structures allocated, and a floppy disk has all but the master and extended partition boot sectors and the diagnostic cylinder. These structures are created by the DOS FDISK program, which cannot be used on a floppy disk because they cannot be partitioned. Figure 22.3 is a simple diagram showing the relative locations of these DOS disk-management structures on the 32M hard disk in an IBM AT Model 339.
Each disk area has a purpose and function. If one of these special areas is damaged, serious consequences can result. Damage to one of these sensitive structures usually causes a domino effect, limiting access to other areas of the disk or causing further problems in using the disk. For example, DOS cannot read and write files if the FAT is damaged or corrupted. Therefore, you should understand these data structures well enough to be able to repair them when necessary. Rebuilding these special tables and areas of the disk is essential to the art of data recovery.

Master Partition Boot Sectors
To share a hard disk among different operating systems, the disk might be logically divided into one to four master partitions. Each operating system, including DOS (through versions 3.2), might own only one partition. DOS 3.3 and later versions introduced the extended DOS partition, which allows multiple DOS partitions on the same hard disk. With the DOS FDISK program, you can select the size of each partition. The partition information is stored in several partition boot sectors on the disk, with the main table embedded in the master partition boot sector. The master partition boot sector is always located in the first sector of the entire disk (cylinder 0, head 0, sector 1). The extended partition boot sectors are located at the beginning of each extended partition volume.
Each DOS partition contains a DOS volume boot sector as its first sector. With the DOS FDISK utility, you might designate a single partition as active (or bootable). The master partition boot sector causes the active partition's volume boot sector to receive control when the system is started or reset. Additional master disk partitions can be set up for Novell NetWare, and for OS/2's HPFS, NTFS, AIX (UNIX), XENIX, or other operating systems. These foreign operating system partitions cannot be accessed under DOS, nor are DOS partitions normally accessible using other operating systems. (OS/2 and Windows NT can access FAT partitions, the high-performance file system (HPFS) is exclusive to OS/2, and the NTFS is exclusive to Windows NT.)
A hard disk must be partitioned in order to be accessible by an operating system. You must partition a disk even if you want to create only a single partition. The following table shows the format of the Master Boot Record (MBR) with partition tables.

Master Boot Record
Offset Length Description
Partition Table #1
1BEh 446 1 byte Boot Indicator Byte (80h = Active, else 00h)
1BFh 447 1 byte Starting Head (or Side) of Partition
1C0h 448 16 bits Starting Cylinder (10 bits) and Sector (6 bits)
1C2h 450 1 byte System Indicator Byte (see Table 22.5)
1C3h 451 1 byte Ending Head (or Side) of Partition
1C4h 452 16 bits Ending Cylinder (10 bits) and Sector (6 bits)
1C6h 454 1 dword Relative Sector Offset of Partition
1CAh 458 1 dword Total Number of Sectors in Partition
Partition Table #2
1CEh 462 1 byte Boot Indicator Byte (80h = Active, else 00h)
1CFh 463 1 byte Starting Head (or Side) of Partition
1D0h 464 16 bits Starting Cylinder (10 bits) and Sector (6 bits)
1D2h 466 1 byte System Indicator Byte (see Table 22.5)
1D3h 467 1 byte Ending Head (or Side) of Partition
1D4h 468 16 bits Ending Cylinder (10 bits) and Sector (6 bits)
1D6h 470 1 dword Relative Sector Offset of Partition
1DAh 474 1 dword Total Number of Sectors in Partition
Partition Table #3
1DEh 478 1 byte Boot Indicator Byte (80h = Active, else 00h)
1DFh 479 1 byte Starting Head (or Side) of Partition
1E0h 480 16 bits Starting Cylinder (10 bits) and Sector (6 bits)
1E2h 482 1 byte System Indicator Byte (see Table 22.5)
1E3h 483 1 byte Ending Head (or Side) of Partition
1E4h 484 16 bits Ending Cylinder (10 bits) and Sector (6 bits)
1E6h 486 1 dword Relative Sector Offset of Partition
1EAh 490 1 dword Total Number of Sectors in Partition
Partition Table #4
1EEh 494 1 byte Boot Indicator Byte (80h = Active, else 00h)
1EFh 495 1 byte Starting Head (or Side) of Partition
1F0h 496 16 bits Starting Cylinder (10 bits) and Sector (6 bits)
1F2h 498 1 byte System Indicator Byte (see Table 22.5)
1F3h 499 1 byte Ending Head (or Side) of Partition
1F4h 500 16 bits Ending Cylinder (10 bits) and Sector (6 bits)
1F6h 502 1 dword Relative Sector Offset of Partition
1FAh 506 1 dword Total Number of Sectors in Partition

Signature Bytes
Offset Length Description
1FEh 510 2 bytes Boot Sector Signature (55AAh)

DOS Volume Boot Sectors
The volume boot sector is the first sector on any area of a drive addressed as a volume (or logical DOS disk). On a floppy disk, for example, this sector is the first one on the floppy disk because DOS recognizes the floppy disk as a volume without the need for partitioning. On a hard disk, the volume boot sector or sectors are located as the first sector within any disk area allocated as a nonextended partition, or any area recognizable as a DOS volume.
This special sector resembles the master partition boot sector in that it contains a program as well as some special data tables. The first volume boot sector on a disk is loaded by the system ROM BIOS for floppies or by the master partition boot sector on a hard disk. This program is given control; it performs some tests and then attempts to load the first DOS system file (IO.SYS). The volume boot sector is transparent to a running DOS system; it is outside the data area of the disk on which files are stored.
You create a volume boot sector with the DOS FORMAT command (high-level format). Hard disks have a volume boot sector at the beginning of every DOS logical drive area allocated on the disk, in both the primary and extended partitions. Although all the logical drives contain the program area as well as a data table area, only the program code from the volume boot sector in the active partition on a hard disk is executed. The others are simply read by the DOS system files during boot-up to obtain their data tables and determine the volume parameters.
The volume boot sector contains program code and data. The single data table in this sector is called the media parameter block or disk parameter block. DOS needs the information it contains to verify the capacity of a disk volume as well as the location of important features such as the FAT. The format of this data is very specific.
Errors can cause problems with booting from a disk or with accessing a disk. Some OEM versions of DOS have not adhered to the standards set for the format of this data, which can cause interchange problems with disks formatted by different versions of DOS. The later versions can be more particular, so if you suspect that boot sector differences are causing inability to access a disk, you can use a utility program such as DOS DEBUG or Norton Utilities to copy a boot sector from the newer version of DOS to a disk formatted by the older version. This step should enable the new version of DOS to read the older disk and should not interfere with the less particular older version. This has never been a problem in using different DOS versions from the same OEM, but might occur when mixing different OEM versions. Table 22.6 shows the format and layout of the DOS Boot Record (DBR).

DOS Boot Record (DBR) Format
Hex Dec Field Length Description
00h 0 3 bytes Jump Instruction to Boot Program Code
03h 3 8 bytes OEM Name and DOS Version (IBM 5.0)
0Bh 11 1 word Bytes/Sector (usually 512)
0Dh 13 1 byte Sectors/Cluster (must be a power of 2)
0Eh 14 1 word Reserved Sectors (Boot Sectors, usually 1)
10h 16 1 byte FAT Copies (usually 2)
11h 17 1 word Maximum Root Directory Entries (usually 512)
13h 19 1 word Total Sectors (If Partition <= 32M, else 0)
15h 21 1 byte Media Descriptor Byte (F8h for Hard Disks)
16h 22 1 word Sectors/FAT
18h 24 1 word Sectors/Track
1Ah 26 1 word Number of Heads
1Ch 28 1 dword Hidden Sectors (If Partition <= 32M, 1 word only)

For DOS 4.0 or Higher Only, Else 00h
Hex Dec Field Length Description
20h 32 1 dword Total Sectors (If Partition > 32M, else 0)
24h 36 1 byte Physical Drive No. (00h=floppy, 80h=hard disk)
25h 37 1 byte Reserved (00h)
26h 38 1 byte Extended Boot Record Signature (29h)
27h 39 1 dword Volume Serial Number (32-bit random number)
2Bh 43 11 bytes Volume Label ("NO NAME" stored if no label)
36h 54 8 bytes File System ID ("FAT12" or "FAT16")

For All Versions of DOS
Hex Dec Field Length Description
3Eh 62 448 bytes Boot Program Code
1FEh 510 2 bytes Signature Bytes (55AAh)

Root Directory
A directory is a simple database containing information about the files stored on a disk. Each record in this database is 32 bytes long, with no delimiters or separating characters between the fields or records. A directory stores almost all of the information that DOS knows about a file: name, attribute, time and date of creation, size, and where the beginning of the file is located on the disk. (The information a directory does not contain about a file is where the file continues on the disk and whether the file is contiguous or fragmented. The FAT contains that information.)
There are two basic types of directories: the root directory and subdirectories. Any given volume can have only one root directory, and the root directory is always stored on a disk in a fixed location immediately following the two copies of the FAT. Root directories vary in size because of the different types and capacities of disks, but the root directory of a given disk is fixed. After a root directory is created, it has a fixed length and cannot be extended to hold more entries. Normally, a hard disk volume has a root directory with room for 512 total entries. Subdirectories are stored as files in the data area of the disk and therefore have no fixed length limits.
Every directory, whether it is the root directory or a subdirectory, is organized in the same way. A directory is a small database with a fixed record length of 32 bytes. Entries in the database store important information about individual files and how files are named on a disk. The directory information is linked to the FAT by the starting cluster entry. In fact, if no file on a disk were longer than one single cluster, the FAT would be unnecessary. The directory stores all of the information needed by DOS to manage the file, with the exception of the list of clusters that the file occupies other than the first one. The FAT stores the remaining information about the other clusters that the file occupies.
To trace a file on a disk, you start with the directory entry to get the information about the starting cluster of the file and its size. Then you go to the file allocation table, where you can follow the chain of clusters that the file occupies until you reach the end of the file. DOS directory entries are 32 bytes long and are in the format shown in the next table.

DOS Directory Format
Offset Hex Dec Field Length Description
00h 0 8 bytes File name
08h 8 3 bytes File extension
0Bh 11 1 byte File attributes
0Ch 12 10 bytes Reserved (00h)
16h 22 1 word Time of creation
18h 24 1 word Date of creation
1Ah 26 1 word Starting cluster
1Ch 28 1 dword Size in bytes
File names and extensions are left-justified and padded with spaces (32h). The first byte of the file name indicates the file status as follows.

Hex File Status
00h Entry never used; entries past this point not searched
05h Indicates that the first character of the file name is actually E5h
E5h [sigma] (lowercase sigma) indicates that the file has been erased
2Eh . (period) indicates that this entry is a directory. If the second byte is also 2Eh, the cluster field contains the cluster number of the parent directory (0000h, if the parent is the root).

DOS Directory File Attribute Byte - Bit positions
7 6 5 4 3 2 1 0 Hex Value Description
0 0 0 0 0 0 0 1 01h Read-only file
0 0 0 0 0 0 1 0 02h Hidden file
0 0 0 0 0 1 0 0 04h System file
0 0 0 0 1 0 0 0 08h Volume label
0 0 0 1 0 0 0 0 10h Subdirectory
0 0 1 0 0 0 0 0 20h Archive (updated since backup)
0 1 0 0 0 0 0 0 40h Reserved
1 0 0 0 0 0 0 0 80h Reserved
Examples
0 0 1 0 0 0 0 1 21h Read-only, archive
0 0 1 1 0 0 1 0 32h Hidden, subdirectory, archive
0 0 1 0 0 1 1 1 27h Read-only, hidden, system, archive

File Allocation Tables
The file allocation table (FAT) is a table of number entries describing how each cluster is allocated on the disk. The data area of the disk has a single entry for each cluster. Sectors in the nondata area on the disk are outside the range of the disk controlled by the FAT. The sectors involved in any of the boot sectors, file allocation table, and root directory are outside the range of sectors controlled by the FAT.
The FAT does not manage every data sector specifically, but rather allocates space in groups of sectors called clusters or allocation units. A cluster is one or more sectors designated by DOS as allocation units of storage. The smallest space a file can use on a disk is one cluster; all files use space on the disk in integer cluster units. If a file is one byte larger than one cluster, two clusters are used. DOS determines the size of a cluster when the disk is high-level formatted by the DOS FORMAT command.
You can think of the FAT as a type of spreadsheet that tracks the allocation of the disk's clusters. Each cell in the spreadsheet corresponds to a single cluster on the disk; the number stored in that cell is a code indicating whether the cluster is used by a file, and if so, where the next cluster of the file is located.
The numbers stored in the FAT are hexadecimal numbers that are either 12 or 16 bits long. The 16-bit FAT numbers are easy to follow because they take an even two bytes of space and can readily be edited. The 12-bit numbers are 1 1/2 bytes long, which presents a problem because most disk sector editors show data in byte units. To edit the FAT, you must do some hex/binary math to convert the displayed byte units to FAT numbers. Fortunately, (unless you are using the DOS DEBUG program), most of the available tools and utility programs have a FAT editing mode that automatically converts the numbers for you. Most of them also show the FAT numbers in decimal form, which most people find easier to handle.
The DOS FDISK program determines whether a 12-bit or 16-bit FAT is placed on a disk, even though the FAT is written during the high-level format (FORMAT). All floppy disks use a 12-bit FAT, but hard disks can use either. On hard disk volumes of more than 16M (32,768 sectors), DOS creates a 16-bit FAT; otherwise, DOS creates a 12-bit FAT.
DOS creates two copies of the FAT. Each one occupies contiguous sectors on the disk, and the second FAT copy immediately follows the first. Unfortunately, DOS uses the second FAT copy only if sectors in the first FAT copy become unreadable. If the first FAT copy is corrupted, which is a much more common problem, DOS does not use the second FAT copy. Even the DOS CHKDSK command does not check or verify the second FAT copy. Moreover, whenever DOS updates the first FAT, large portions of the first FAT automatically are copied to the second FAT.
If the first copy was corrupted and then subsequently updated by DOS, a large portion of the first FAT would be copied over to the second FAT copy, damaging it in the process. After the update, the second copy is usually a mirror image of the first one, complete with any corruption. Two FATs rarely stay out of sync for very long. When they are out of sync and DOS writes to the disk, causing the first FAT to be updated, it also causes the second FAT to be overwritten by the first FAT. This is why disk repair and recovery utilities warn you to stop working as soon as you detect a FAT problem. Programs like Norton Disk Doctor use the second copy of the FAT as a reference to repair the first one, but if DOS has already updated the second FAT, repair may be impossible.

Clusters (Allocation Units)
The term cluster was changed to allocation unit in DOS 4.0. The newer term is appropriate because a single cluster is the smallest unit of the disk that DOS can handle when it writes or reads a file. A cluster is equal to one or more sectors. Although a cluster can be a single sector, it is usually more than one. Having more than one sector per cluster reduces the size and processing overhead of the FAT and enables DOS to run faster because it has fewer individual units to manage. The trade-off is in wasted disk space. Because DOS can manage space only in full-cluster units, every file consumes space on the disk in increments of one cluster.

Default Floppy Disk Cluster (Allocation Unit) Sizes
Drive Type Cluster (Allocation Unit) Size
5 1/4-inch 360K 2 sectors (1,024 bytes)
5 1/4-inch 1.2M 1 sector (512 bytes)
3 1/4-inch 720K 2 sectors (1,024 bytes)
3 1/4-inch 1.44M 1 sector (512 bytes)
3 1/4-inch 2.88M 2 sectors (1,024 bytes)

It seems strange that the high-density disks, which have many more individual sectors than low-density disks, sometimes have smaller cluster sizes. The larger the FAT, the more entries DOS must manage, and the slower DOS seems to function. This sluggishness is due to the excessive overhead required to manage all the individual clusters; the more clusters to be managed, the slower things become. The trade-off is in the minimum cluster size.
Smaller clusters generate less slack (space wasted between the actual end of each file and the end of the cluster). With larger clusters, the wasted space grows larger. High-density floppy drives are faster than their low-density counterparts, so perhaps IBM and Microsoft determined that the decrease in cluster size balances the drive's faster operation and offsets the use of a larger FAT.
For hard disks, the cluster size can vary greatly among different versions of DOS and different disk sizes. Table 22.10 shows the cluster sizes that DOS selects for a particular volume size.

Default Hard Disk Cluster (Allocation Unit) Sizes
Hard Disk Volume Size Cluster (Allocation Unit) Size FAT Type
0M to less than 16M 8 sectors or 4,096 bytes 12-bit
16M through 128M 4 sectors or 2,048 bytes 16-bit
More than 128-256M 8 sectors or 4,096 bytes 16-bit
More than 256-512M 16 sectors or 8,192 bytes 16-bit
More than 512-1,024M 32 sectors or 16,384 bytes 16-bit
More than 1,024-2,048M 64 sectors or 32,768 bytes 16-bit

In most cases, these cluster sizes, selected by the DOS FORMAT command, are the minimum possible for a given partition size. Therefore, 8K clusters are the smallest possible for a partition size of greater than 256M. Although most versions of DOS work like this, some versions might use cluster sizes different from what this table indicates.
The effect of these larger cluster sizes on disk use can be substantial. A drive containing about 5,000 files, with average slack of one-half of the last cluster used for each file, wastes about 20M [5000*(.5*8)K] of file space.
Note that Windows NT and OS/2 already have more sophisticated file systems that do away with the FAT structure, and which are not subject to the limitations of FAT partitions. The FAT32 file system included in the Windows 95 OSR2 release allows for more than 64K clusters. Because there can be more clusters, the individual clusters can be smaller. This alleviates the large cluster size problem for larger drives, and extends the maximum size for a partition on a hard disk from 2GB to 2TB. The cluster sizes used on FAT32 drives of various sizes are as follows:
Drive Size Cluster Size
0MB to less than 260MB 512 bytes
260MB - 8GB 4,096 bytes
8 - 16GB 8,192 bytes
16 - 32GB 16,384 bytes
32GB - 2TB 32,768 bytes

The Data Area.
The data area of a disk is the area that follows the boot sector, file allocation tables, and root directory on any volume. This area is managed by the FAT and the root directory. DOS divides it into allocation units sometimes called clusters. These clusters are where normal files are stored on a volume.

Diagnostic Read-and-Write Cylinder
The FDISK partitioning program always reserves the last cylinder of a hard disk for use as a special diagnostic read-and-write test cylinder. That this cylinder is reserved is one reason FDISK always reports fewer total cylinders than the drive manufacturer states are available. DOS (or any other operating system) does not use this cylinder for any normal purpose, because it lies outside the partitioned area of the disk.
On systems with IDE, SCSI, or ESDI disk interfaces, the drive and controller might allocate an additional area past the logical end of the drive for a bad-track table and spare sectors. This situation may account for additional discrepancies between FDISK and the drive manufacturer.
The diagnostics area enables software such as a manufacturer-supplied Advanced Diagnostics disk to perform read-and-write tests on a hard disk without corrupting any user data. Low-level format programs for hard disks often use this cylinder as a scratch-pad area for running interleave tests or preserving data during nondestructive formats. This cylinder is also sometimes used as a head landing or parking cylinder on hard disks that do not have an automatic parking facility.