ACLClouds
ACLClouds

Error “No space left on device”: the VPS disk is full

Find the full volume, large folders and inodes, then delete files safely. A full disk can prevent SSH, APT, Docker, and databases from writing.

A full disk can prevent SSH, APT, Docker, and databases from writing. The space percentage and number of inodes should be checked separately.

Step-by-step procedure

  1. Identify the volume

    Run df -hT, then df -i. A volume can run out of inodes even if gigabytes of space are still free.

  2. Find large folders

    Use the du command on the same filesystem and check /var/lib/docker, /var/log and backups.

  3. Clean with caution

    Compress or delete known old logs and exports. Do not use docker system prune -a on a production server.

  4. Prevent recurrence

    Configure log rotation, backup retention and an alert when usage reaches 85%.

Disk diagnostics

df -hT
df -i
du -xhd1 /var 2>/dev/null | sort -h
journalctl --disk-usage
docker system df

Find large files

du -xh / --max-depth=1 2>/dev/null | sort -h
find / -xdev -type f -size +500M -exec ls -lh {} + 2>/dev/null
lsof +L1

Before you start

The "Disks" page under "Additional tools" shows the capacity allocated to the VPS, not the space used inside Linux. The real usage is read inside the VM with df -h. If SSH no longer answers because the disk is full, open the "noVNC console" or use the panel "Shell" for short commands.

  • Note the full mount point (/, /var, /home) before deleting anything.
  • Copy to another machine any file you are not sure is useless.

Where the space usually goes

Check these locations in order, measuring each with du -sh before cleaning:

  • The systemd journal: journalctl --vacuum-size=200M shrinks it to 200 MB.
  • /var/lib/docker: unused images and container JSON logs, to be capped with max-size in /etc/docker/daemon.json.
  • /var/cache/apt: apt clean deletes packages that were already downloaded.
  • Backups and exports (.sql, .tar.gz) left behind in /root or /home.

Check that everything works

Run df -h again: the volume must be back under 85 %. Then restart the services that had failed, for example systemctl restart nginx, and run systemctl --failed: the list must be empty.

Frequently asked questions

df -h shows 100 % but du finds much less, why?

A deleted file stays on disk as long as a process keeps it open, often a log removed by hand. lsof +L1 lists these files and the process involved: restart that service to free the space. To empty an active log without deleting it, use truncate -s 0 followed by the file path.

Why No space left on device when df -h shows free space?

The file system has run out of inodes: df -i then shows 100 % in the IUse% column. The cause is a very large number of small files (PHP sessions, cache, mail queues). du --inodes -xd1 /var | sort -n shows the folder holding the most.

MariaDB or MySQL no longer restarts after a full disk, what should I do?

First free space elsewhere, then run systemctl restart mariadb and read journalctl -u mariadb -n 50. Never delete the ibdata1 or ib_logfile* files or the binary logs by hand: purge the binary logs with PURGE BINARY LOGS from the SQL client.

Does docker system prune delete my data?

Without options, it removes stopped containers, unused networks, untagged images and the build cache, but not volumes. --volumes also deletes unattached volumes, which may hold databases. Check docker ps -a first: a stopped container you meant to restart will be lost.