Following the file allocation tables is the root directory. This area contains 32-byte entries that describe files, subdirectories, and the volume label (if present). In FAT12 and FAT16 versions of dosfs, the root directory is fixed, and is determined by the mkfs(ADM) command. The number of entries in the root directory and the directory's location on the disk can be obtained from the BPB in the boot sector, at offset 0X0011.
Each file's entry in the root directory contains the number of the first cluster assigned to that file, which is used as an entry point into the FAT. From the entry point on, each FAT slot contains the cluster number of the next cluster in the file, until a last-cluster mark is encountered.
The traditional directory entry (used in FAT12 and FAT16 DOS filesystems) has been slightly modified in the VFAT version of the DOS filesystem type, and is now known as a ``short name entry''). The modifications allow the creation date and creation time of the file to be stored. (In earlier versions of the DOS filesystem type, file creation date and time were lost once the file was modified.) The structure of short name entries in the root directory is illustrated in the next figure.
The structure of short name and alias name entries in the disk directory
The VFAT version of the DOS filesystem introduces two additional types of directory entries, to accommodate long filenames. These are the ``long name entry'' and the ``alias name entry''. The structure of an alias name entry is the same as the short name entry. The structure of long name entries in the root directory is illustrated in the next figure.
The structure of long name entries in the root directory
One or more long name entries are used to store filenames that are more than 13 characters and up to 255 characters. Each long filename has a corresponding alias name entry. An alias name entry has the same structure as a short name entry, and is a compressed 8.3 format filename derived from the long name. It is necessary so that applications and utilities that only understand traditional 8.3 DOS filenames can continue to work on newer files which may have names longer than 13 characters. It is also crucial for recording the creation, access, and modification dates and times, the starting cluster, the file size, and the attributes of the file.
In the FAT32 version of the dosfs filesystem type, the root directory is no longer a special control area. The limitations of fixed location and fixed size no longer hold, thus the root directory can contain any number of sub-directories.