Interview Prep/Linux/Storage & Memory

Why might `du` show much less than `df` even with no deleted open files?

AdvancedConceptStorage & Memory
Answer

Data can be hidden under a mount point: files written to /data before a disk was mounted on /data still occupy the root filesystem but are invisible. Check with a bind mount of root:

sudo mount --bind / /mnt/rootonly
sudo du -sh /mnt/rootonly/data

Other causes: ext4 reserved blocks (5% by default, see tune2fs -l), filesystem metadata/journal, and snapshots on btrfs/ZFS.

All Linux questions Roadmap: Linux

More on Storage & Memory