Skip to main content

File system layout, i-node, backup

Short answer

A file system layout contains boot block, superblock, free-space management, i-node array, root directory, and data area. An i-node stores file attributes and block addresses (direct, indirect). Backups include full, incremental, physical, and logical dumps to recover from loss.

What is a file system layout? Explain about I-Node and file system backup.

File system layout

A file system layout is the way the disk is organised to store the file system. A disk is divided into partitions; each partition holds an independent file system.

 Sector 0                      whole disk
 +-----+-----------+-------------+-------------+
 | MBR | Partition | Partition 1 | Partition 2 |
 |     |   table   |             |   ...       |
 +-----+-----------+-------------+-------------+

 One partition:
 +------+-------+----------+---------+------+----------------+
 | Boot | Super | Free-    | I-nodes | Root | Files and      |
 | block| block | space    |         | dir  | directories    |
 |      |       | mgmt     |         |      |                |
 +------+-------+----------+---------+------+----------------+
  • MBR (Master Boot Record): sector 0; contains boot code and the partition table with start and end of each partition and the active one. The BIOS reads and runs it, which loads the boot block of the active partition.
  • Boot block: first block of a partition; program that loads the operating system.
  • Superblock: key information about the file system: type (magic number), number of blocks, block size, number of i-nodes, free-block counts.
  • Free space management: bit map or list of free blocks.
  • I-nodes: an array of i-nodes, one per file (attributes and block addresses).
  • Root directory: top of the directory tree.
  • Data area: all the other files and directories.

I-node

An i-node (index node) is a data structure in UNIX that holds the attributes of one file (owner, permissions, size, timestamps, link count, type) and the disk addresses of its blocks. The i-node number identifies a file; a directory entry is just (file name, i-node number). Only the i-nodes of open files are kept in memory, so memory use depends on the number of open files, not on the disk size.

 i-node
 +------------------+
 | attributes       |
 | direct block 1   |--> data
 |   ...  (10)      |
 | direct block 10  |--> data
 | single indirect  |--> [addr][addr]... --> data
 | double indirect  |--> [ptr] --> [addr].. --> data
 | triple indirect  |--> ...
 +------------------+

With 1 KB blocks and 4-byte addresses, 10 direct blocks give 10 KB; single indirect (256 addresses) adds 256 KB; double indirect adds 64 MB; triple adds 16 GB.

File system backup

Backups protect against disasters (hardware failure, fire, theft) and against accidental deletion or corruption. Issues and techniques:

  • Full (complete) dump: copy the entire file system; slow and large.
  • Incremental dump: copy only files changed since the last dump (full or incremental). Quick, but restore needs the full dump plus all increments; a bit is kept per file (archive bit) or a modification time is compared.
  • Physical dump: copy disk block by block from block 0; simple and fast, but copies unused blocks and bad blocks need care.
  • Logical dump: starts at one or more directories and copies all files and directories changed since a given date, along with the path to them (as UNIX dump does with four phases: mark all directories and the changed files, unmark unneeded directories, dump directories, dump files). It allows restoring individual files.
  • Compression and encryption can be applied; backups are kept at a different physical location.
  • Other approaches: snapshots, mirroring/RAID (not a backup but protects against hardware failure).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 5 questions →