Your data is organized into files—collections of data that represent one single unit. All operating systems have a preferred method to organize these files on storage devices, to make them easy to find and use.

Before we look at how your operating system organizes these files, let’s take a look at what it’s organising them on. Most storage media is in the form of a disk, organized into tracks, sectors and blocks. Sectors are like slices of a bread—any disk is made up of a large number of sectors. Tracks are concentric circles that start at the centre of the disk and move outward to the edge. Blocks are the areas that lie between sectors and tracks: it is the blocks where data is stored.

As users, we can’t really be expected to understand how to store our data in these sectors and blocks, so our operating system gives us a file system, which is its way of protecting us from having to understand storage devices—by showing us our data in a friendlier way. To be more specific, the OS shows us our data organized into directories, which contain our files. Directories may also contain sub-directories, which could contain more subdirectories and files, and so on. While nearly all OSes organize data into directories, the ways they finally write the data to the disk are different.

The simplest file system is the File Allocation Table (FAT), which is understood by most OSes today. Let’s look at it this way—the hard drive is a massive warehouse with many shelves (sectors), and each shelf with many boxes (blocks). The OS is the supervisor of this warehouse. Let’s say that the warehouse is empty right now. A new truckload of files has arrived, and the OS must now put them away into the shelves. It starts at the first shelf and begins putting the files in their boxes. If a file is too big for the box, it splits it up and starts filling new boxes till the entire file is stored. While it stores the files, it takes notes in its FAT, which is its handy guide to all the files in the warehouse. The FAT tells it which file is stored in which shelf, and this helps it locate it quickly if a program asks for that file.

The FAT16 file system, introduced for MS DOS, had a 16-bit FAT counter. This meant it could write 65,535 entries into the FAT. Each entry corresponded to one block, and each block could hold 32 kilobytes of data. This added up to a support for only 2 GB disks. Then came FAT32, which could theoretically support disks up to 2 terabytes in size, but there have been problems with this, and to be safe, the maximum disk size is limited to 32 GB.

The NTFS (New Technology File System), introduced by Microsoft for Windows NT, took file organisation one step further. For one thing, it added journaling—it writes changes to data in a “journal” before it actually makes the changes. This way, if the system crashes and the OS sees data that doesn’t make sense, it just runs through the journal and keeps making changes till everything is nice and consistent once again. NTFS also brought security and access control to file storage.

Another type of file system is the Log Structured File System. In this case, the journal is the filesystem itself, which allows for “time travel”—you could go back and look at older versions of the same data. If data gets corrupted, it becomes easy to just go back to when everything was running fine. Right now, though, there is no Log Structured File System that has commercial popularity.

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!