Labs ICT
Pro Login

File System Concepts

How data is organized, stored, and retrieved on disk.

How Files Actually Work

You save a file, give it a name, and find it later. Simple, right? Behind that simplicity is a sophisticated system that manages how data is organized, stored, and retrieved on disk. The file system is the OS component responsible for all of this.

Think of a file system like a library's catalog system. The library has thousands of books on shelves, but without a catalog, finding a specific book would be impossible. The catalog tells you exactly which shelf, which row, and which position each book occupies. The file system does the same for your data — it keeps track of where every byte is stored on disk.

Files and Directories

The two fundamental concepts in any file system are files and directories (or folders):

  • A file is a named collection of data. It can contain anything — text, images, programs, videos. The file system stores the data and maintains metadata about it (name, size, creation date, permissions).
  • A directory is a container that holds files and other directories. Directories form a tree structure, starting from the root directory (/ on Unix, C:\ on Windows).

The directory structure is what allows you to organize files hierarchically. Your documents folder might contain subfolders for work, personal, and school — each containing files. The file system tracks all these relationships.

File Attributes

Every file has attributes that the file system maintains:

  • Name — The human-readable identifier (like "report.txt").
  • Type — What kind of file it is (executable, text, image, etc.).
  • Size — How many bytes the file contains.
  • Location — Where on disk the file's data is stored.
  • Protection — Who can read, write, or execute the file.
  • Timestamps — When the file was created, last modified, and last accessed.
  • Owner — Which user or process created the file.

All of this information is stored separately from the file's actual data. The data lives in data blocks on disk, while the metadata lives in a special data structure (like an inode on Unix or an MFT entry on NTFS).

File Operations

The file system provides a set of operations that programs use to interact with files:

  • Create — Allocate space and add a new entry to the directory.
  • Delete — Remove the directory entry and free the space.
  • Open — Prepare the file for reading or writing. The OS loads its metadata into memory for quick access.
  • Read — Copy data from the file into the program's memory.
  • Write — Copy data from the program's memory into the file.
  • Seek — Move the file pointer to a specific position within the file.
  • Close — Release the file's resources and flush any buffered data to disk.

When you open a file, the OS finds it in the directory, checks your permissions, loads its metadata, and gives you a file handle — a reference you use for all subsequent operations.