Disk Space Essentials
Understanding Linux Storage Fundamentals
Linux storage management is a critical skill for system administrators and developers. Disk space is measured in various units that represent data storage capacity. Understanding these units helps in effective filesystem management.
Storage Units Overview
Unit |
Size |
Equivalent |
Byte |
1 B |
Smallest storage unit |
Kilobyte |
1 KB |
1,024 bytes |
Megabyte |
1 MB |
1,024 KB |
Gigabyte |
1 GB |
1,024 MB |
Terabyte |
1 TB |
1,024 GB |
Filesystem Structure and Disk Allocation
graph TD
A[Root Filesystem /] --> B[/home]
A --> C[/var]
A --> D[/etc]
A --> E[/tmp]
Practical Disk Space Exploration
To examine disk space allocation in Ubuntu, use the following commands:
## Display filesystem disk space usage
df -h
## Show detailed filesystem information
df -T
## Check inode usage
df -i
Code Explanation
-
df -h
: Displays human-readable disk space usage
-h
flag provides sizes in KB, MB, GB
- Shows total, used, and available space
- Helps quickly assess storage consumption
-
df -T
: Reveals filesystem types
- Identifies ext4, xfs, btrfs filesystem types
- Critical for understanding storage architecture
-
df -i
: Checks inode allocation
- Shows total, used, and free inodes
- Helps diagnose filesystem capacity issues beyond physical space
Disk Space Calculation Example
Consider a system with 500 GB total storage:
- 200 GB used in
/home
- 50 GB used in
/var
- Remaining space available for other partitions
By understanding these fundamentals, administrators can effectively manage linux storage, prevent space exhaustion, and optimize filesystem performance.