Operating Systems and their File Systems

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:

  • FAT12: The oldest of the FAT versions, uses a 12-bit binary number to hold the cluster number. A disk volume formatted using FAT 12 can hold a maximum of 4,086 clusters, which is 2^12 less a handful of reserved clusters to be used by the FAT itself. FAT 12 is the most suitable of the versions for very small volumes, and is primarily used on floppy disks. If your into nostalgia, you might find an old (really old) computer with a hard disk formatted as FAT 12, which is a partition of about 16 MB.
  • FAT16: This is the FAT version most often found in older systems, and for small partitions on modern systems. It uses a 16-bit binary number to hold cluster numbers. When you see the generic reference to FAT, it is usually referring to FAT 16. This is because it became the de facto standard for hard disks, even though FAT 32 now more popular. A volume using FAT 16 can hold a maximum of 65,526 clusters, which is 2^16 less a few FAT 16 reserves for itself. FAT16 is used for hard disk volumes ranging in size from 16 MB to 2,048 MB. VFAT is a variant of FAT16.
  • FAT32: The last of the FAT types, FAT32 is supported by all newer versions of Windows®, which includes Windows® 95 OEM SR2, Windows® 98, Windows® ME, Windows® 2000 and Windows® XP. Although FAT 32 is believed by many to use a 32-bit binary cluster number, this is not the case, as it is a 28-bit binary cluster number, with 4 of the 32 bits in reserve. 28 bits is more than enough to create huge drive volumes, and Microsoft has stated that in theory, a FAT 32 volume can be created with over 268 million clusters, supporting drive capacities up to 2 Terabytes in size. If you were to do this, however, the FAT volume grows substantially and along with it the slack inherent to FAT volumes. We discuss FAT 32 in more detail below and you may want to review our brief segment entitled How Fat is FAT to get an idea what “slack” is.

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.

About Dewwa Socc

Sahifa Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.