Kennisbank

Disk is full: how to free space Afdrukken

  • disk, storage, logs, troubleshooting
  • 0

Overview

A full disk causes failed writes, crashed databases and services that will not start. This article shows how to find what is consuming space and reclaim it safely.

Before you begin

  • Root or sudo access.
  • Careful judgement: delete only files you understand. When in doubt, take a snapshot first.

Steps

  1. Confirm which filesystem is full:

bash df -h

  1. Find the biggest directories, starting at the root:

bash sudo du -xh / --max-depth=1 | sort -h

Then drill into the largest one, for example /var:

bash sudo du -xh /var --max-depth=1 | sort -h

  1. Clear the usual suspects:
    • Systemd journal:

bash sudo journalctl --disk-usage sudo journalctl --vacuum-size=200M

  • Old logs: check /var/log, and ensure logrotate is running (cat /etc/logrotate.conf).
  • Package cache:

```bash sudo apt clean

or

sudo dnf clean all ```

  • Old kernels: remove unused kernels via your package manager.
    1. Find large individual files:

bash sudo find / -xdev -type f -size +500M -exec ls -lh {} \; 2>/dev/null

  1. Check for deleted-but-open files that still hold space (common with busy services):

bash sudo lsof | grep deleted

Restarting the service holding the file releases the space.

  1. Check backups, container images and temp directories — /var/lib/docker, /tmp, /var/tmp and app upload folders often grow quietly.
  2. Add capacity if needed. Resize the disk or add a Storage Box in the ALYPOD Console and move backups and archives there.

Troubleshooting

  • Problem: df says the disk is full but du finds nothing. Solution: Use lsof | grep deleted — a process is holding a deleted file open.
  • Problem: You cannot log in because the disk is full. Solution: Use the VNC console, clear the journal and apt cache, then investigate further.

Related articles

  • [Diagnosing high CPU or memory usage]
  • [The server will not boot]
  • [Keeping your server patched]

Was dit antwoord nuttig?

« Terug