operating-systems file-management

Definition

File System Layout

The file system layout describes the physical organisation of data on a disk partition. It ensures that the OS can locate the root directory and manage allocated vs. free blocks.

Disk Structure

A physical disk is typically divided into one or more partitions, each containing an independent file system.

Master Boot Record (MBR)

Located in Sector 0 of the disk. It contains:

  • Boot Code: Executed by the BIOS during system start.
  • Partition Table: Stores the start/end addresses of all partitions and identifies the active partition.

Partition Layout

A typical Unix/Linux partition layout includes:

  • Boot Block: Used to load the OS kernel from this partition.
  • Super Block: Contains critical metadata about the file system (e.g., size, block count, magic number, and pointers to other structures).
  • Free Space Management: Tracks unallocated blocks (e.g., via a bit table).
  • i-node Table: Contains an array of i-nodes, one for each potential file.
  • Root Directory: The top of the file hierarchy.
  • Files & Directories: The actual user data blocks.