File System

You know FAT is a filesystem, that NTFS is a better filesystem, etc. But what is a filesystem? How do they work?

Dumping a cupboard-full of documents, audio cassettes, video tapes and even photo albums on a hard drive or DVD might sound easy, but is actually a complex process. Operating systems use logical data structures for storing, organising and keeping track of files on a partition or on an optical disc, called a filesystem.

The basic function of a filesystem is to make efficient use of disk space for data storage, ease basic file operations (read, write, copy and delete) and catalogue files for faster retrieval.

A disk partition is like a compartment in a train, while the filesystem is the seating arrangement fixed within the compartments. Before using any partition on a disk, a logical filesystem needs to be initialised on it. Let’s have a look at how a typical filesystem works.
 
How Filesystems Work

The space in a hard drive is divided into units called sectors, usually of 512 bytes. The filesystem groups the sectors together after creating a sector index; the group is called a cluster or an allocation unit. It’s difficult for the filesystem to deal with data on a sector-by-sector basis, so when the filesystem needs to access a sector  for a read-write operation, it will first define the cluster number of that sector. Then from that cluster, it will use the sector index to access that particular sector.

Each logical volume (hard drive) has a table—called the File Allocation Table (FAT)—that carries all the information about the sectors and the files stored on those sectors.

Types Of Filesystems
Disk-based filesystems

These would be found on hard disks, CD-ROMs and DVDs. Files are stored in a sequence of bytes on fixed-sized blocks called sectors; these filesystems feature random-access file reads and writes, and also file fragmentation across the disk.

Some disk-based filesystems also have journalling and versioning. In a Journalling filesystem like XFS on the Silicon Graphics platform, changes in files are logged first in a specially-allocated area called a Journal before they’re actually written on the main filesystem. Versioning filesystems like OpenVMS allow for the existence of several versions of the same file, and take periodic backups.

Popular disk-based filesystems include:

Windows: New Technology File System (NTFS), File Allocation Table (FAT, FAT16, FAT32), and many more; Linux: ext, ext2, ext2fs, NSS, ReiserFS and several others based on Linux and Unix variants

Mac OS X: Hierarchical filesystem (HFS ), HFS, Macintosh filesystem (MFS), Xsan

Disk-based filesystems can be further classified into:
Solid-state media filesystems: These are designed for storing files on devices that rely on Flash memory as their storage. Such filesystems require special handling, because data blocks wear out if information is repetitively written and rewritten on the drive. Besides, the blocks have to be erased explicitly before any data is written on them. The Journaling Flash filesystem (JFFS) and Yet Another Flash filesystem (YAFFS), are popular solid-state filesystems.

Record-oriented filesystems: The basic purpose of such filesystems is to store files in the form of records to be compatible with older operating systems that are used exclusively on mainframes and minicomputers.

Shared-disk filesystem: These are also known as SAN (Storage Area Network) filesystems or Cluster filesystem. As the name suggests, they are used on huge blocks of storage which are directly accessible to computers via a network connection.
   
Network Filesystems

Network filesystems (or distributed filesystems) support the sharing of files, printers and other computing resources over a network. The performance of such filesystems is measured by the time it requires to satisfy the service requests by different computers connected on the network.

Such filesystems are found on file-servers and provide access to files by acting as clients for remote access protocols like NFS (Network filesystem) or SMB (Server Message). NFS and SMB are popular examples of network filesystems.

Several network filesystems prevail today:
9P, Apple Filing Protocol (AFP), NetWare Core Protocol (NCP), Coda, Distributed File System (DFS) and Google File System (GFS), to name a few.

Filesystems are critical for storage media to run properly with the operating system. Regular maintenance and protection from malware is not only advisable, it’s necessary.

Samir Makwana
Digit.in
Logo
Digit.in
Logo