Disk Space Basics
Understanding Disk Storage in Linux
In Linux systems, managing disk space is a critical skill for system administrators and developers. Disk storage is organized into several key components that help users understand and optimize their storage resources.
Filesystem Hierarchy
Linux uses a hierarchical filesystem structure, with the root directory (/
) serving as the top-level entry point. Different partitions and storage devices are mounted at various points in this hierarchy.
graph TD
A[Root Directory /] --> B[/home]
A --> C[/var]
A --> D[/etc]
A --> E[/usr]
Disk Space Measurement Units
Understanding disk space measurements is crucial for effective management:
Unit |
Size |
Description |
Byte |
1B |
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 |
Basic Disk Space Commands
Linux provides several built-in commands to help users understand disk space:
df
(Disk Free): Shows filesystem disk space usage
df -h ## Human-readable format
du
(Disk Usage): Estimates file and directory space consumption
du -sh /home ## Summary of /home directory
lsblk
(List Block Devices): Displays information about block devices
lsblk ## List all block devices
Disk Partitioning Basics
Linux supports multiple partitioning schemes, with the most common being:
- MBR (Master Boot Record)
- GPT (GUID Partition Table)
Partition Types
- Primary Partitions
- Extended Partitions
- Logical Partitions
Filesystem Types
Linux supports various filesystem types:
- ext4 (Most common)
- XFS
- Btrfs
- NTFS (with additional drivers)
Storage Management Considerations
When managing disk space, consider:
- Available storage capacity
- Performance requirements
- Backup and redundancy
- Scalability
LabEx Tip
For hands-on practice in disk space management, LabEx provides interactive Linux environments that allow you to experiment safely with these concepts.