Cloud & Operations · Practical News

Disk Full on the Server: Find Who Is Writing Before Deleting Anything

Source: Paddy Dance teamKeywords: server disk full

Which kind of full

df -h shows space, df -i shows inodes. Space remaining but inodes exhausted produces the same write failures, yet the remedy is deleting many small files rather than a few large ones.

A surprising share of "site down, upload failing, database error" incidents trace back to skipping this distinction.

Locating the growth

Walk down from the root with du, focusing on log, backup, temporary and upload directories. Check for processes appending to a single huge file, such as logs without rotation.

If the database directory is growing fast, check slow queries and binary logs first. Never delete tablespace files directly.

Deletion cautions

Deleting a file still held open by a process does not free space until the process restarts or the file is truncated. Confirm a usable backup exists before deleting anything that might be the only copy.

The durable fixes are log rotation, retention policies for backups, moving uploads to object storage, and disk usage alerts.

FAQ

Why is space unchanged after deleting files?

A process still holds the file open, so the directory entry is gone but the blocks remain. Find the process with lsof and restart it, or truncate the file instead.

Can logs just be deleted?

Truncate the contents, but avoid removing a file that is actively being written. Better to configure rotation and retention so the system manages it.

Database disk usage exploded. What now?

Check binary logs and slow query logs, then look for large transactions or unarchived historical data. Clean up or archive only after verifying backups.

Related questions

Troubleshooting disk spaceLogs filling the diskInodes exhaustedSpace not freed after deletion

Further reading

Sources & References

The following are public sources. Always check the latest requirements on the official authority or platform page.

Explain your case first, then confirm the scope

Tell us your entity, business model and current progress. We will confirm what we can assist with and what you need to do before discussing fees.