Back to lessons

Hosting Operations

Check Bytes and Inodes Before Cleanup

A host is failing writes and you need to know whether byte usage or inode usage is the tighter limit before deleting anything.

Command

df -h /lab/disk-inode-cleanup && df -ih /lab/disk-inode-cleanup

What changed

Nothing changes. The command prints filesystem byte and inode summaries.

Danger

safe

When to use it

Use at the start of disk incidents before deciding whether to hunt large files or huge counts of small files.

When not to use it

Do not treat df output as a cleanup plan; it only identifies the pressured filesystem.

Undo or recovery

No undo needed because both checks are read-only.

Expected output

Two filesystem tables: one for byte usage and one for inode usage.

demo script

Disposable terminal steps

  1. df -h /lab/disk-inode-cleanup
  2. df -ih /lab/disk-inode-cleanup

simulated output

What it looks like

disposable vessel
::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
$ df -ih /lab/disk-inode-cleanup
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/vda1        512K  499K   13K   98% /lab/disk-inode-cleanup
tmpfs            245K    14  245K    1% /run
::exit-code::0

YouTube Short

Check bytes and inodes.

Before deleting anything, check both df views. A filesystem can have free space and still run out of inodes.

LinkedIn hook

No space left can mean full bytes, full inodes, or both.

Question: During disk incidents, do you check inode pressure before cleanup?

experiments

A/B tests to run

Metric: save_rate

A: No space left has two meanings.

B: Check bytes and inodes before cleanup.