Hosting Operations
Keep du on One Filesystem
You need a directory-level size view without crossing filesystem boundaries during disk triage.
Command
du -xh --max-depth=1 /lab/disk-inode-cleanup/var 2>/dev/null | sort -h
What changed
Nothing changes. The command measures apparent usage and keeps the scan on one filesystem.
Danger
safe
When to use it
Use after df identifies the pressured mount and you need a scoped directory ranking.
When not to use it
Do not run broad recursive scans from / during a busy incident unless the extra I/O is acceptable.
Undo or recovery
No undo needed because du only reads metadata and file sizes.
Expected output
A human-readable size list for direct children under the selected var directory.
demo script
Disposable terminal steps
df -h /lab/disk-inode-cleanupdu -xh --max-depth=1 /lab/disk-inode-cleanup/var 2>/dev/null | sort -h
simulated output
What it looks like
::fixture-ready::
$ df -h /lab/disk-inode-cleanup
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 24G 680M 98% /lab/disk-inode-cleanup
tmpfs 982M 12M 970M 2% /run
::exit-code::0
$ du -xh --max-depth=1 /lab/disk-inode-cleanup/var 2>/dev/null | sort -h
8.0K /lab/disk-inode-cleanup/var/log
8.0K /lab/disk-inode-cleanup/var/tmp
664K /lab/disk-inode-cleanup/var/cache
684K /lab/disk-inode-cleanup/var
::exit-code::0
YouTube Short
Scope your disk scan.
After df names the full mount, use du with xdev behavior and a max depth so the scan stays targeted.
LinkedIn hook
A cleanup scan should not wander into mounted backups or network storage.
Question: Do your disk cleanup scans intentionally avoid mounted backup paths?
experiments
A/B tests to run
Metric: completion_rate
A: Do not scan the whole machine.
B: Keep du on the pressured filesystem.