Linux VPS Disk Full: A Safe Recovery Sequence
Updated · Autdo Cloud
When a VPS disk is full, identify what consumed the space before deleting data. Blindly removing database files, container volumes or entire log directories can cause a more serious outage than the original capacity problem.
Confirm the exhausted resource
Check df -h for byte capacity and df -i for inodes. Determine which mounted filesystem is affected. Then inspect likely directories with a bounded command such as sudo du -xhd1 /var, recognizing that a large scan can add I/O load.
Stop avoidable growth
Identify runaway logs, failed jobs, repeated uploads or a retry loop creating temporary files. If possible, stop the source of uncontrolled growth through its normal service controls. Preserve the evidence needed to understand the problem.
Logs may contain useful incident history or sensitive data. Rotate and retain them according to a deliberate policy. A deleted log still held open by a process can continue occupying space until that file handle closes.
Recover deliberately
Remove only files you have identified as disposable and do not need for recovery. Use the application's supported cleanup mechanism where available. For Docker, inspect usage and understand volume ownership before pruning. For databases, use database-aware maintenance rather than filesystem deletion.
If expansion is available, verify the full chain from allocation to block device, partition and filesystem. Expanding one layer does not automatically expand every other layer.
Verify and prevent recurrence
Check that writes, services and backups work again. Add capacity alerts and sensible log retention. See disk inspection, backup capacity and Docker persistence.