Disk Pressure on Linux: Inodes, Deleted Files and the Cleanup You Can Defend
Free bytes are only half the story. Diagnose inode exhaustion, open deleted files and runaway logs before deleting data that merely happens to be large.

A deployment fails with no space left on device, yet the dashboard says the disk is only sixty percent full. The missing clue might be inode exhaustion. Or the disk is genuinely full, but the directory sizes do not add up because a process still holds a deleted file open.
Storage incidents reward inspection before action. Deleting the biggest-looking directory can turn a service interruption into a data-loss event without addressing the actual cause.
Identify the failing filesystem
Start with the path that failed. A host can have separate root, data and temporary filesystems, each with its own limits. A container may also have a writable-layer or volume constraint that the host-wide chart does not express.
df -hT /var/lib/example
df -i /var/lib/example
findmnt -T /var/lib/exampleThe path is illustrative. The first command reports byte usage and filesystem type, the second inode usage, and the third the relevant mount. Also check whether the application hit a user or project quota. "Disk full" is sometimes an application interpretation of a narrower allocation failure.
Do not assume free space is usable by the service account. Filesystem reservations, permissions and quotas can make root's view different from the worker's practical capacity.
Compare allocation with visible files
Use directory summaries constrained to the filesystem so you do not accidentally traverse unrelated mounts:
sudo du -xhd1 /var | sort -hThis inspection can be expensive on a busy filesystem. Narrow the path and run during an appropriate window if traversal competes with production I/O. Reconcile units and sparse-file behaviour before treating every difference between du and df as a leak.
Snapshots and filesystem-specific accounting can also explain space that a plain directory walk does not show. Use the tools for your actual filesystem rather than applying an ext4 explanation to every storage system.
Check open deleted files
On Linux, unlinking a file removes its name, but a process holding it open can keep the allocated storage until the handle closes. This is common when somebody manually deletes an active log.
sudo lsof +L1Review the process, descriptor and size. Restarting the owning service may release storage, but that is a service action with operational consequences. Use the application's supported log reopen or reload mechanism when appropriate, and verify space afterward.
Do not manipulate /proc descriptors casually to truncate an unknown database or application file. Being able to make bytes disappear is not evidence that the process can safely continue.
Diagnose inode exhaustion
Millions of tiny session, cache or temporary files can exhaust inode capacity while using relatively few bytes. Locate the growing tree and understand its retention policy before removing it.
Avoid unbounded recursive listings during an incident. They can produce enormous output and load. Count and sample within a suspected directory, and distinguish active files from abandoned ones using the application's actual ownership and lifetime rules.
If a cache has no expiry mechanism, cleanup alone buys time. Fix the creation and retention behaviour. Changing storage capacity without addressing the growth pattern simply schedules the next incident.
Reclaim known disposable data
- Journal logs — Apply reviewed retention using journalctl controls
- Application logs — Repair rotation and reopen handling
- Package caches — Use the package manager's documented cleanup
- Temporary jobs — Remove only expired, unreferenced job data
- Database files — Use database maintenance, not arbitrary deletion
Check journal size with journalctl --disk-usage. Vacuuming archived journals can reclaim space but is destructive to retained logs; choose a retention target approved for operations and incident review. Active journals and rotation behaviour need separate understanding.
A Docker prune command can remove images, caches or volumes needed for rollback or recovery depending on its options. Review the exact command and inventory before using it. Avoid treating every stopped container as disposable.
Protect the recovery path
If a database has stopped because of disk pressure, preserve its files and follow that database's recovery guidance. Deleting transaction logs directly can prevent restart or invalidate recovery assumptions.
Create enough safe headroom for normal operation, not merely enough to start a process once. A workload can immediately refill the disk with a backlog or crash log loop. Watch growth rate as well as free capacity.
Record every destructive cleanup with the path, reason and retention decision. This is not bureaucracy during an outage; it is how another operator knows what evidence or data is no longer available.
Monitor the right limits
Track byte usage, inode usage, relevant quotas and growth rate for each important mount. Include the writable storage actually used by containers and workers. Alert before your remaining capacity is smaller than a normal import or log burst.
The goal is a diagnosis that explains the mismatch: which resource ran out, what consumed it and why retention failed. Once those are known, cleanup can be narrow, recovery can be verified and prevention can address the cause rather than the largest directory.
Paj Digital Labs
The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.
Related reading

PostgreSQL Connection Budgets: Pooling Without Hiding the Bottleneck
More application workers can exhaust database connections long before CPU is full. Budget the whole fleet, understand pool modes and test session behaviour before adding a pooler.

Restore Drills for a Whole Website: Rebuild the Service, Not Just the Database
A database restore can succeed while the website remains unusable. Test files, configuration, identity, DNS and external dependencies in an isolated recovery environment.

TLS Certificate Renewal: Verify the Served Certificate, Not Just the Cron Job
A successful renewal command does not prove visitors see the new certificate. Trace issuance, reloads, proxy termination and external monitoring before an expiry becomes an outage.