codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Subjects
🖥️

Operating Systems

25 chapters

1Intro to OS & Kernel Architecture2Process Concept & Lifecycle3System Calls & Interrupts4Process Management & PCB5Inter-Process Communication (IPC)6CPU Scheduling (FCFS, SJF, RR)7Threads (User vs Kernel Level)8Process Synchronization9Critical Section Problem10Producer-Consumer Problem11Dining Philosophers Problem12Deadlock Conditions & Prevention13Banker's Algorithm (Avoidance)14Memory Management & Paging15Memory Allocation (First Fit, Best Fit)16Paging and Segmentation17Translation Lookaside Buffer (TLB)18Virtual Memory & Demand Paging19Page Replacement Algorithms20Thrashing21File Systems & Directory Structure22File Allocation Methods23Disk Scheduling Algorithms24I/O Systems & DMA25OS Protection & Security
SubjectsOperating Systems

File Systems & Directory Structure

Updated 2026-04-26
2 min read

File Systems & Directory Structure

A File System is the component of the OS responsible for managing how data is stored on and retrieved from storage devices (hard drives, SSDs). It provides an abstraction layer so users and applications deal with named files and directories instead of raw disk sectors.

1. File Attributes

Every file has metadata associated with it:

  • Name: The human-readable identifier.
  • Type: Extension-based (.txt, .pdf, .exe) or magic-number-based.
  • Size: In bytes.
  • Permissions: Read, Write, Execute permissions for Owner, Group, Others (Unix: rwxr-xr-x).
  • Timestamps: Created, Modified, Accessed.
  • Owner: The user who owns the file.
  • Location: Pointers to the disk blocks containing the file's data.

2. Directory Structure

Directories organize files into a hierarchical namespace.

Single-Level Directory

All files in one directory. Simple but impossible to manage with many files. Name conflicts are inevitable.

Two-Level Directory

Each user gets their own directory. Solves naming conflicts between users but not within a user's files.

Tree-Structured Directory (Modern Standard)

Directories form a tree. Each directory can contain files and subdirectories. This is what Linux (/home/user/Documents/) and Windows (C:\Users\Documents\) use.

  • Absolute Path: Starts from the root (/home/user/file.txt).
  • Relative Path: Relative to the current working directory (./file.txt).

Acyclic-Graph Directory

Allows shared subdirectories and files (hard links, symbolic links). A file can be accessed from multiple directory paths. Deletion is complex (reference counting or back-pointers needed).

3. Common File Systems

  • ext4: The standard Linux file system. Supports journaling, extents, and files up to 16TB.
  • NTFS: The standard Windows file system. Supports ACLs, encryption, compression, and journaling.
  • APFS: Apple File System for macOS and iOS. Optimized for SSDs, supports snapshots and cloning.
  • FAT32: Old but universally compatible. Used on USB drives. 4GB file size limit.
  • ZFS/Btrfs: Advanced file systems with built-in RAID, snapshots, checksums, and self-healing capabilities.

4. Journaling

A Journaling File System maintains a log (journal) of changes that are going to be made before they are actually written to the main file system. If the system crashes during a write, the journal can be replayed to bring the file system to a consistent state, avoiding corruption and eliminating the need for a full fsck scan.



PreviousThrashingNextFile Allocation Methods

Recommended Gear

ThrashingFile Allocation Methods