File Systems

Microsoft Disk Operating Sysytem

File Systems
(alphabetical order)


Some definitions and general technology

I don't want to be highly subjective, but this citate does give a nice introduction of MS-DOS, to give you an idea what more to read on this page.
MS-DOS /M-S-dos/ n.
MicroSoft Disk Operating System. A clone of CP/M for the 8088 crufted together in 6 weeks by hacker Tim Paterson at Seattle Computer Products, who called the original QDOS (Quick and Dirty Operating System) and is said to have regretted it ever since. Microsoft licensed QDOS order to have something to demo for IBM on time, and the rest is history. Numerous features, including vaguely Unix-like but rather broken support for subdirectories, I/O redirection, and pipelines, were hacked into Microsoft's 2.0 and subsequent versions; as a result, there are two or more incompatible versions of many system calls, and MS-DOS programmers can never agree on basic things like what character to use as an option switch or whether to be case-sensitive. The resulting appalling mess is now the highest-unit-volume OS in history. Often known simply as DOS, which annoys people familiar with other similarly abbreviated operating systems (the name goes back to the mid-1960s, when it was attached to IBM's first disk operating system for the 360). The name further annoys those who know what the term operating system does (or ought to) connote; DOS is more properly a set of relatively simple interrupt services. Some people like to pronounce DOS like "dose", as in "I don't work on dose, man!", or to compare it to a dose of brain-damaging drugs (a slogan button in wide circulation among hackers exhorts: "MS-DOS: Just say No!").
So, feel like making your own judgement about (the file system of) MS-DOS? Read on....

back to IT stuff


Figure 1. lists the main charactersitics of the MS-DOS file system, in comparison with the file system of UNIX.
File names in MS-DOS are shorter, but you're allowed to use more types of characters: besides the ASCII-set, it knows 128 other characters like the accent grave or the infinity sign. However its better known that MS-DOS doesn't make a difference between standard letters and capitals, whereas UNIX and UNIX-like OSs do and the \ and /.
The file attributes MS-DOS uses are readonly, archive, system and hidden.
The naming scheme is far from location independent or transparant: when e.g. copying a file to another disk you must specify the location with the drive letter. The main reason for this, and the lack of a security mechanism, is that MS-DOS was designed for a stand alone PC, and never meant to be a network operating system.

Hierarchical directory system? Yes Yes
Current directory? Yes Yes
Absolute and relative path names? Yes Yes
Directories . and ..? Yes Yes
Character special files Yes Yes
Block special files? Yes Yes
Length file names: 14 or 255 8 + 3
Character between the components of the names: / \
a equals A? No Yes
Owners, groups, protection? Yes No
Links? Yes No
Mounted file systems? Yes No
File attributes? No Yes
Figure 1. Comparison between the file systems of MS-DOS and UNIX.

Thus far about the concepts. Its implementation is "something completely different".

back to IT stuff


The layout of the disk is visualised in Figure 2. and 3.
- The bootsector: contains a JUMP-instruction to be able to load the ROM-bootstrap directly into memory; then some parameters (like bytes per sector, amount of file allocation tables, device size etc.); after that the bootstrap code (looks for the root directory) and at the end the partition table. The partition table contains elements to makr the beginning and end of a partition (max. 4)
- Directly after the bootsector is the FAT (File Allocation Table), with the information/administration of the space on the device: one element for each block. Each block can consist of 1 to 8 sectors. Partitions larger than 32 MB need block sizes that are larger than the normally used size of 512. The FAT is quite similar to the i-node table in UNIX.

primary boot sector partition 1 partition 2 partition 3 partition 4
(e.g. UNIX)
Figure 2. The whole disk

secondary boot sector FAT optional FAT duplicate root directory data block many more data blocks ... data block (end of partition)
Figure 2. One partition of the disk.

1. Say, you do a system call OPEN. First thing to happen is MS-DOS looking for a free file descriptor in the file descriptor table (contains a 1 byte index in the central system file table {which is similar to the i-node in UNIX] that marks it in use/not in use).
2. Upon finding a free file descriptor, a free position in the system file table is located.
If that's fine too, a name extension check and "con"/"lpt" is performed. If it isn't one of those special files, the beginning of the path name is checked (\ means an absolute path) to determine where to start looking for the requested file.
3. It starts looking in the directoy-element, which is something of 32 bytes for each file or directory. It contains info like the file name, the attributes, time stamp, file size etc, but most important in this situation: the physical location (number) of the first data block. With this numer a chain reaction can be started, because each block does have the number of the following block etc till the end of the file. This set up is also the reason why it's not possible to implement links: you can't have two elements with the same number for the first block. If it were the situation each would have its owm time stamp, date and size, wich would lead to inconsistencies in the file system. (FYI: in UNIX the element only contains the filename and i-node number, therefore links are possible).
4. Assume that the lookup went ok. The directory-element will be copied to the system file table and the file posisiton is set to 0.
5. The file descriptor is delivered to the caller, and you're done with OPEN.

The Microsoft desktop OSs are based on MS-DOS, but hidden under a nice GUI. They made a few changes that they call enhancements to the FAT32 (in Windows 95 OSR2, Windows 98, Windows 2000, and Windows Me) I'd like to mention here.
- It supports drives up to 2 terabytes in size (however, FAT partitions are limited in size to a maximum of 4 Gigabytes (GB) under Windows NT and 2 GB in MS-DOS)). - The space in the drive is used more efficiently: FAT32 uses smaller clusters (that is, 4K clusters for drives up to 8 GB in size), resulting in 10 to 15 percent more efficient use of disk space relative to large FAT16 drives. - More robust (...): FAT32 has the ability to relocate the root directory and use the backup copy of the FAT instead of the default copy. In addition, the boot record on FAT32 drives has been expanded to include a backup of critical data structures (which ones exactly?). This means that FAT32 drives are less susceptible to a single point of failure than existing FAT16 volumes. - More flexible. The root directory on a FAT32 drive is now an ordinary cluster chain, so it can be located anywhere on the drive. For this reason, the previous limitations on the number of root directory entries no longer exist. In addition, FAT mirroring can be disabled, allowing a copy of the FAT other than the first one to be active. These features allow for dynamic resizing of FAT32 partitions. Note, however, that while the FAT32 design allows for this capability, it will not be implemented by Microsoft in the initial release (so, in which one is it implemented?).

References and more information
Modern Operating Systems, A.S. Tanenbaum, Ch 8.
Q154997 MS KB article about FAT32 (in Win95/98/ME)
Q100108 MS KB article called Overview of FAT, HPFS, and NTFS File Systems
Everything2 MS-DOS node