Welcome to Day 20 of the 30 Days of Linux Challenge!

Today I focused on disk usage and file system monitoring — a must-have skill for preventing crashes, outages, and silent failures in Linux systems.

If you've ever had a system fail because /var or /tmp filled up, you'll know why this topic is crucial.

📚 Table of Contents

Why Disk Monitoring Matters

Linux won't always alert you when:

  • Disk space is about to run out
  • Backups are failing due to full storage
  • Logs are overwhelming /var

Without monitoring:

  • Applications can crash
  • Services may silently fail
  • You risk total system instability

Check Disk Space with df

df -h

Flag Meaning
-h Human-readable (GB, MB, etc.)

Image description

Sample output:

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 100G 75G 25G 75% /
tmpfs 16G 0 16G 0% /dev/shm

Analyze Directory Size with du

du -sh /var/log

Image description

Break down large folders:

du -h --max-depth=1 /home

Image description

Useful for finding:

  • Disk-heavy users
  • Log folders gone wild
  • Forgotten downloads

View Block Devices with lsblk

lsblk

Visualizes:

  • Disks
  • Partitions
  • Mount points
  • LVM volumes

Example:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part /

Image description

Mounted File Systems with mount

mount | column -t

See:

  • Devices
  • Mount paths
  • File system types

Image description

Alternative:

findmnt

Image description

Find Large Files

All files over 1 GB

find / -type f -size +1G 2>/dev/null

Image description

Sort by size:
ls -lhS /var/log

Interactive viewer:

sudo dnf install ncdu
sudo ncdu /

Clean-Up Tips

Clear package cache:

sudo dnf clean all

Image description

Truncate log files:
sudo truncate -s 0 /var/log/messages

Clear systemd journal logs:
sudo journalctl --vacuum-time=7d

Try It Yourself

-Check overall disk usage
df -h

-Identify large folders
du -h --max-depth=1 /var

-List block devices
lsblk

-Search large files
find / -type f -size +500M

-Check mount points
mount | column -t

Real-World Use Cases

Task Tool Used
Monitor storage usage df, lsblk
Identify large folders/files du, find, ls -lhS
Visualize partition layout lsblk, mount, findmnt
Clean unused data dnf clean, truncate, journalctl
Validate backup targets df, ncdu

Why This Matters

Running out of disk space can:

  • Break services and applications
  • Cause data loss
  • Crash entire systems
  • Monitoring and cleaning storage isn’t optional — it’s survival.