Operating Systems and their File Systems

If you have arrived here through a search engine, and there's no menu to the left click here!

When preparing a segment such as this, an adequate discussion tends to blur the line between hardware issues associated with hard disks and the software issues that control what is placed on them and in what manner. As manufacturers and operating system developers strive for performance and security, this line tends to blur even more. The very nature of the logical structures on a hard disk influences their performance, reliability, expandability and compatibility. Let's see if we can blend the hardware and software issues into something that is easily understood, without getting bored!

In spite of all of the media hype about them, a hard disk is merely a medium for storing information. A replacement for the limited capacity of the floppy disk, which was the first type of disk storage media available on small computers. As hard disks grow in capacity, becoming larger and larger every year, it is becoming increasingly difficult for operating systems and their companion file systems, to use them in an efficient manner. The file system employed by most operating systems today is a generic name given to the software routines and logical structures used to prepare the given hard disk to store data as well as control access to that particular storage space. Different operating systems use different methods of organizing and controlling access to the data on the hard disk, which is entirely independent of the specific hardware in use. A single hard disk can be prepared in many different ways to store data, and under given circumstances a hard disk may even be prepared multiple ways on the same disk.

Logical Disk Structures

To begin this segment, we will take a look at the logical structures typically associated with hard disks and how they are set up and used in a typical computer system. We'll begin with a brief discussion of the different operating systems, and an overview of the different file system types. As we move through the overview, we will go into some detail describing the major structures and the key operational details of the most common of the small computer file systems, FAT, which includes FAT12, FAT16, VFAT and FAT32. Although we discuss disk utilities elsewhere in our Knowledge Center, we'll spend a few moments throughout this segment reviewing the most common utilities used for partitioning and formatting hard disks, and also talk a bit about disk compression. Many "thought to be" knowledgeable individuals are now espousing that disk optimization is not nearly as important as it once was, and while we won't get bogged down on the subject, optimization is still an important aspect of disk, as well as overall system, performance.

The two most common file systems in use today are the FAT family of file systems, and NTFS, predominantly used in the Windows NT® family of operating systems, including Windows® NT 3.x, 4.0, Windows® 2000 and now Windows® XP. This segment wouldn't be complete if we didn't at least mention alternative file systems, such as Linux, OS/2 and BeOS, however we won't be going into great detail on them as we haven't had that many requests to do so. Essentially, we have broken down this discussion into two areas, the FAT family of file systems and the NTFS family of file systems. Although the FAT and NTFS files systems are different, they are also related, therefore we will start with the FAT file system as a precursor to NTFS.

The operating system can be anything from a small footprint (minimal resource) limited user interface application, to a full blown GUI (graphical user interface) interface with all of the bells, whistles and full use of the color spectrum. Regardless of which it is, either one will be a large, relatively complex, low-level piece of software that interfaces your software applications to your hardware. The operating system you use is directly linked to the file system that manages the data that will be stored on your hard disk. Some operating systems are designed specifically to work with more than one type of file system, more for compatibility reasons than any other, which others work only with their own specific file system. As an example, Windows® 95/98 uses the FAT file system, while Windows® 2000 and Windows® XP can use either FAT or NTFS.

FAT Sizes
FAT12, FAT16 and FAT32

Throughout this portion of our discussion of file systems, we will refer to the FAT family of file systems, which includes several different variations of FAT related file systems, such as IBM's DOS, Microsoft's MS-DOS®, DR-DOS® etcetera. The file allocation table or FAT stores information about the clusters on the disk in a table. There are three different varieties of this file allocation table, all of which vary depending upon the maximize size of the table. The disk utility that you use to partition the hard disk will normally choose the correct type of FAT for the disk volume you are creating or using, however you normally will be given the opportunity to choose which you would like to use.

Since each cluster has one entry in the FAT, and these entries are used to hold the cluster number of the next cluster used by the file, the size of the FAT is the limiting factor on how many clusters any disk volume can contain.

The three different FAT versions now in use:

Here is a comparison of the three FAT versions:

Attribute

FAT12

FAT16

FAT32

Used For

Floppies and very small hard disk volumes

Small to moderate- sized hard disk volumes

Medium-sized to very large hard disk volumes

Size of Each FAT Entry

12 bits

16 bits

28 bits

Maximum Number of Clusters

4,086

65,526

~268,435,456

Cluster Size Used

0.5 KB to 4 KB

2 KB to 32 KB

4 KB to 32 KB

Maximum Volume Size

16,736,256

2,147,123,200

about 2^41

File Allocation Tables

In order to understand the importance of the FAT, or the file allocation table, you must first understand how space is allocated on the hard disk (or any disk for that matter) under operating systems that use the FAT family of file systems. This includes DOS and all early versions of Windows®, beginning with 3.x through Windows® 98 Second Edition. Actually, Windows® NT through Windows® XP uses FAT as well, but only under certain circumstances.

Data is stored in individual 512-byte sectors on the hard disk. Theoretically, it is possible for each file to be allocated to a number of individual sectors, and this is in fact done for some file systems such as HPFS. However, for performance reasons, individual sectors are not allocated to files in the FAT file system. The reasoning is that it would take considerable system overhead, both in time and disk space, to keep track of all of the pieces of files that were extremely small and spread over many sectors. As an example, a 10 GB disk partition would have 20,000,000 and today's 80 GB drives 160,000,000 sectors! To avoid some of this overhead, disks are instead broken into larger pieces called clusters, or alternatively, allocation units, with each cluster containing a number of sectors. Typically, clusters range in size from 2,048 bytes to 32,768 bytes, which corresponds with 4 to 64 sectors each. You can review more about clusters by clicking here: Clusters and how they work.

The file allocation table is where information about clusters is stored. Each cluster has an entry in the FAT that describes how it used. Essentially, this is what tells your operating system which parts of the disk are currently in use by files, and which are free for use. The FAT entries are used by the operating system to chain together clusters to form files. A brief discussion about cluster chaining can be found here.

The file allocation tables are stored in the area of the disk immediately following the volume boot sector. Each disk volume actually contains two identical copies of the FAT. The second copy is intended as a form of  backup in the event there is damage to the main or first copy of the FAT. Damage to the FAT usually results in data loss since this "the" record of which parts of the disk contain which files. Although a nice thought, we recommend that you not rely on this backup copy in the event that the primary FAT becomes damaged.

Unfortunately, in everyday use, the backup FAT system doesn't work well at all for the simple reason that both FAT copies reside right next to each other on the disk. There are two reasons for this . First, if bad sectors develop on the disk where the first copy of the FAT is stored, chances are pretty good that the second copy will be affected as well. Second, disk utilities frequently duplicate the primary FAT to the backup FAT location. This means that any corruption that arises in the primary FAT may be duplicated to the backup copy before it is noticed.

When FAT 32 was released, some improvements had been made to the backup scheme. First, either copy of the FAT can be designated the "primary" or "backup". Second, the method by which the FAT is copied from the primary to the backup location can be disabled. The combination of these features allows the second FAT to be protected and used in the event of problems with the first.

Let's move on to some FAT Specifics

Notice: Windows® 95, Windows® 98, Windows® NT, Windows® 2000, Windows® XP and
Microsoft® Office are registered trademarks or trademarks of the Microsoft Corporation.
All other trademarks are the property of their respective owners.

Copyright ©1995-2002 DEW Associates Corporation. All rights reserved.