Disk Monitoring — Monitoring Storage Usage and Disk Health¶
Disk Monitoring is the process of tracking disk space, filesystem usage, inode consumption, disk I/O performance, and storage health to ensure Linux systems continue operating reliably. Running out of disk space or experiencing storage performance issues can cause application failures, database corruption, logging problems, and even system crashes. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, and Site Reliability Engineer (SRE) should know how to monitor storage resources proactively in production environments.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Monitor disk space usage
- Analyze filesystem utilization
- Monitor inode usage
- Identify large files and directories
- Understand disk I/O
- Monitor storage performance
- Troubleshoot disk space issues
- Apply production monitoring best practices
Prerequisites¶
Complete:
- Modules 1–11
- Module 12 Lessons 1–4
Why Learn Disk Monitoring?¶
Imagine a production database server.
Without monitoring:
With proactive monitoring:
Monitoring storage prevents many production outages.
What is Disk Monitoring?¶
Disk monitoring involves tracking:
- Disk capacity
- Filesystem usage
- Inode usage
- Disk I/O
- Storage performance
- Disk health
- Storage growth
Disk Monitoring Architecture¶
Check Disk Space¶
The most common command:
Example:
Options:
-h→ Human-readable-T→ Display filesystem type
Check Filesystem Types¶
Example:
Monitor Inode Usage¶
Sometimes disk space is available, but no new files can be created because all inodes are used.
Check inode usage:
Example:
Find Large Directories¶
Use:
Check a specific directory.
Example:
Find Large Files¶
Example:
Find files larger than 500 MB.
Sort Directory Sizes¶
Shows the largest files and directories first.
Check Mounted Filesystems¶
Or:
Useful for verifying storage mounts.
Disk Usage by Filesystem¶
Example:
Display filesystem information.
Monitor Disk I/O¶
Install sysstat if needed.
Extended statistics.
Shows:
- Read operations
- Write operations
- Utilization
- Wait times
Monitor Real-Time I/O¶
Displays processes performing disk I/O.
Requires root privileges on many systems.
Check Open Files¶
Sometimes a deleted file still consumes disk space because a process keeps it open.
View open files.
Deleted files:
Check Disk Usage of a Directory¶
Human-readable summary.
Check Available Space¶
Monitor the root filesystem regularly.
Filesystem Health¶
For ext4 filesystems:
Warning
Run fsck only on unmounted filesystems or in maintenance mode unless the filesystem specifically supports online checking.
For XFS:
Run only on an unmounted filesystem unless instructed otherwise.
SMART Disk Health¶
Install SMART tools.
Displays disk health.
Detailed information.
Requires:
Common Commands¶
Check disk space.
Directory usage.
Monitor inodes.
Largest files.
Disk I/O.
Real Production Examples¶
Check root filesystem.
Find large log files.
Monitor I/O.
View deleted open files.
Production Perspective¶
Disk monitoring is essential for:
- Database servers
- Kubernetes nodes
- Web servers
- Logging servers
- CI/CD systems
- Virtual machines
- Cloud infrastructure
- Enterprise storage systems
Storage issues are among the most common causes of production outages.
Hands-on Lab¶
Task 1¶
Check filesystem usage.
Task 2¶
Check inode usage.
Task 3¶
Display the largest directories under /var.
Task 4¶
Find files larger than 500 MB.
Task 5¶
Display mounted filesystems.
Task 6¶
Display block devices.
Task 7¶
Monitor disk I/O.
Task 8¶
Check disk SMART health (if supported).
Command Deep Dive¶
| Command | Purpose | Production Example |
|---|---|---|
df -h | Display filesystem usage | Capacity planning |
du -sh | Directory usage | Storage analysis |
df -i | Monitor inode usage | Filesystem troubleshooting |
find | Locate large files | Disk cleanup |
iostat -x | Monitor disk I/O | Performance analysis |
smartctl | Check disk health | Hardware monitoring |
Common Disk Monitoring Mistakes¶
| Mistake | Solution |
|---|---|
| Monitoring only disk space | Monitor inode usage and I/O as well |
| Ignoring log growth | Configure log rotation |
| Never checking disk health | Monitor SMART status |
| Waiting until disks are full | Configure alerts before capacity limits |
| Deleting files without checking open file handles | Use lsof to verify deleted files are not still in use |
Production Troubleshooting Scenario¶
Scenario
A production application reports:
Investigation:
Disk usage:
Next:
Findings:
The administrator archives old logs, verifies logrotate is functioning correctly, and restores normal disk usage.
Best Practices¶
- Monitor disk space continuously.
- Configure alerts before disks become full (for example, at 80% usage).
- Monitor inode usage in addition to disk capacity.
- Rotate and archive logs regularly.
- Review disk I/O performance.
- Monitor SMART health for physical disks.
- Plan storage expansion before capacity limits are reached.
- Include storage monitoring in centralized monitoring platforms such as Prometheus and Grafana.
Common Mistakes¶
❌ Monitoring only available disk space.
✅ Avoid this mistake: monitoring only available disk space.
❌ Ignoring inode exhaustion.
✅ Always review inode exhaustion.
❌ Never reviewing disk I/O performance.
✅ Always reviewing disk I/O performance.
❌ Allowing log files to consume all available storage.
✅ Do not allow log files to consume all available storage.
❌ Ignoring SMART warnings from storage devices.
✅ Always review SMART warnings from storage devices.
Interview Questions¶
Beginner¶
- What does
df -hdisplay? - What is the difference between
dfanddu? - Why are inodes important?
- Which command lists mounted filesystems?
Intermediate¶
- How do you identify large files consuming disk space?
- What information does
iostat -xprovide? - Why can "No space left on device" occur even when free disk space exists?
- How do you check whether deleted files are still open?
Architect Level¶
- How would you monitor storage across hundreds of Linux servers?
- How would you design alert thresholds for production storage monitoring?
- How would you troubleshoot a Kubernetes node experiencing high disk I/O?
Summary¶
In this lesson, you learned:
- Disk space monitoring
- Filesystem usage
- Inode monitoring
- Large file identification
- Disk I/O analysis
- Filesystem health
- SMART monitoring
- Production storage monitoring best practices
Disk monitoring is essential for maintaining healthy Linux systems. By continuously monitoring storage capacity, inode utilization, disk performance, and hardware health, administrators can prevent outages, improve performance, and ensure reliable operation of production workloads.
Key Takeaways¶
- Use
df -hto monitor filesystem capacity. - Use
duto identify large directories and files. - Monitor inode usage with
df -i. - Analyze disk performance using
iostat. - Monitor physical disk health using SMART tools.
- Configure proactive alerts and capacity planning to prevent storage-related outages.
What's Next?¶
Memory Monitoring — Monitoring RAM and Swap Usage in Linux
You'll explore:
- Understanding Linux memory management
- Physical memory and swap usage
- Monitoring memory consumption
- Using
free,vmstat, and related tools - Identifying memory-intensive processes
- Troubleshooting memory issues
- Production memory monitoring best practices
By the end of the lesson, you'll be able to monitor memory utilization, identify memory bottlenecks, troubleshoot out-of-memory conditions, and optimize memory usage in production Linux environments.