File System Organization
Files are stored in hardware disk structures, commonly in hard disk drives
(HDD) or solid-state devices
(SSD). If we think about file systems, it has two aspects; how is the data organized on the disk, and how is the data on disk accessed to be used in programs? This is where the file management functionality of the operating system comes in. It organizes file systems in data structures
, and provides access through specific access methods
.

Let's look at the overall organization of this.
- The operating system divides the space provided by the disk into a sequence of bits/bytes as
blocks
. These blocks store all kinds of data, such as system and user data. - A portion of these blocks are dedicated to storing user data. They are classified to be in a
data region
. - To track information about each file, file systems have a structure called
inode
. This has all the metadata regarding files such as file size, permissions, access and modification times, etc. Some blocks on disk are also reserved for theseinodes
. They contain references toinode numbers
(yes, the metadata associated with files!). This makes the process of locating the file on disk easier. - The OS also requires a method to track allocation and deallocation of inode and data blocks. For this purpose,
allocation structures
also occupy the blocks on disk. A simple and common allocation structure is thebitmap
, which uses 0 and 1 bits to indicate if the corresponding block is free or not. - One last thing that exists on the disk structure is a block reserved for metadata regarding the file system itself. This block is known as the
superblock
. The metadata includes information on the number of inode and data blocks, file system type, etc. When mounting a file system, the OS always reads the superblock first.

Note that directories are stored in the same way as files. They also occupy blocks, have inode numbers that reference data blocks where directory contents are stored. We could say that they are treated as special kinds of files.