Skip to content

File Systems

A file system organizes and stores data on disk. Key concepts: files (named data), directories (hierarchical organization), inodes (metadata — permissions, size, block pointers), blocks (fixed-size disk units). Common file systems: ext4 (Linux), NTFS (Windows), APFS (macOS). Key operations: open, read, write, close. Access control via permissions (rwx for owner/group/others).

Key Concepts

Deep Dive: Inode Structure
Inode:
├── File type & permissions
├── Owner & group
├── Size
├── Timestamps (access, modify, change)
├── Link count
└── Pointers to data blocks
    ├── Direct pointers (12) → blocks
    ├── Single indirect → pointer block → data blocks
    ├── Double indirect → ptr → ptr → data blocks
    └── Triple indirect → ptr → ptr → ptr → data blocks
Deep Dive: File System Concepts
Concept Description
Hard link Multiple names for same inode
Soft link (symlink) Pointer to another path
Journaling Log changes before applying (crash recovery)
Fragmentation Files scattered across disk (slows reads)
Block size Typically 4KB (matches page size)
Common Interview Questions
  • What is an inode?
  • What is the difference between hard link and symbolic link?
  • What is journaling?
  • How does the OS manage file permissions?
  • What is disk fragmentation?