Making and Mounting a File System
1. Why Do We Need This?
A system may have:
-
Multiple disks
-
Multiple partitions
-
Different file system types
👉 But users should see one unified directory tree
✔ Solution:
-
Create file systems
-
Mount them into a single hierarchy
2. Making a File System
📌 Tool: mkfs (make file system)
🔑 Purpose
Creates a new, empty file system on a storage device (like a disk partition)
📖 Syntax
Example
⚙️ What mkfs Does Internally
When you run mkfs, it:
-
Initializes the disk partition
-
Creates essential structures:
-
Root directory (
/) -
Inodes
-
Free space management
-
-
Writes metadata structures onto disk
👉 After this:
-
The disk contains a valid file system
-
But it is still not accessible to users
3. Mounting a File System
📌 System Call: mount()
📌 Command:
🔑 Concept
👉 Mounting =
Attaching a file system to an existing directory
📖 Example
🔄 What Happens During Mount?
-
/home/usersbecomes the entry point (mount point) -
The root of new file system is attached there
📂 Before Mount
📂 After Mount
📌 Accessing Files
| Path | Meaning |
|---|---|
/home/users/ | root of new FS |
/home/users/a | subdirectory |
/home/users/a/foo | file |
4. Key Insight: Unified Namespace
👉 Mount creates a single global directory tree
✔ User does NOT see:
-
Different disks
-
Different partitions
✔ Everything appears under /
5. Multiple File Systems in One Tree
Example output of mount:
🔍 Types of File Systems
| Type | Purpose |
|---|---|
ext3 | Disk-based storage |
proc | Process information |
tmpfs | Temporary memory-based FS |
AFS | Distributed file system |
🔑 Insight
👉 Different file systems can coexist:
-
Disk storage
-
Memory storage
-
Network storage
✔ All appear as one system
6. Important Concepts
📌 Mount Point
-
A directory where new FS is attached
-
Must exist before mounting
📌 Root of Mounted FS
-
The root (
/) of new FS appears at mount point
📌 Transparency
👉 Users don’t need to know:
-
Where data is physically stored
-
Which device is used
7. Advantages
✅ Simplicity
-
Single directory structure
✅ Flexibility
-
Add/remove storage easily
✅ Modularity
-
Different FS types supported
8. Summary
Emphasize:
👉 Key abstraction
👉 Two-step process:
-
mkfs → create filesystem
-
mount → make it accessible
Comments
Post a Comment