A file system helps the computer keep track of files. It controls how data is stored and retrieved.
A file system is part of the operating system. It organizes data on a storage device like:
Think of a file system like a bookshelf. It keeps books (files) in order, with labels and shelves (folders).
Every file has a small data structure called a File Control Block or FCB.
The FCB stores information like:
The disk is divided into small pieces called blocks.
Files are saved in these blocks. The file system keeps track of which blocks belong to which file.
Imagine storing socks in drawers. Each drawer holds a few socks. You write on paper which drawer has which socks. That paper is like the file table.
There are several ways files can be stored on disk:
The file is stored in one big block of space.
Pros: Fast access.
Cons: Hard to find big enough empty space.
Each part of the file is stored separately. Each block points to the next.
Pros: Easy to grow files.
Cons: Slower to read all parts.
The file has an index block. The index lists all the block locations.
Pros: Easy to access blocks directly.
Cons: Slightly more complex.
Files are placed in directories (folders). This creates a tree-like structure.
Example:
/ ├── home │ ├── alice │ │ └── homework.txt │ └── bob │ └── notes.doc
A file system must be "mounted" before use.
Mounting connects the storage device to the OS's file structure.
The OS must also track empty blocks.
It may use:
There are many file system formats. Each has its own features.
Think of a file system like a filing cabinet in an office. Each drawer (folder) holds files. You have a sheet that shows what file is in which drawer and what page it starts on. That sheet is like the directory table.
Open a command terminal:
In Linux:
df -h
Shows your mounted file systems.
In Windows:
diskpart
View and manage disks and volumes.
Great work! 🎉