Short answer
The disk full error (“No space left on device”) means a filesystem on the server has no room left to write. First find the partition at 100% with df -h, then find which directory on it takes the space with du -xh --max-depth=1. On a VDS the space usually goes to the systemd journal, old logs under /var/log, the package cache, Docker images and container logs, or backups left on the server.
If df shows free space and the error persists, you have run out of inodes (df -i). If deleting a file frees nothing, a process still holds it open (lsof +L1). Once you have freed space, set size limits for journald, logrotate and Docker, or the same thing will happen again.
What happens when a server’s disk fills up?
Anything that needs to write stops. The database cannot write to its tables or its own log, shuts down and will not start again until there is space. Nginx cannot write temporary files, so large requests fail; WordPress media uploads break, and apt or dnf updates stop halfway. You can still log in over SSH, but the shell prints warnings such as “cannot create temp file for here-document: No space left on device”, and tab completion may stop working. The login steps are in “How to connect to a VDS via SSH”.
Because reads keep working, the problem is easy to miss at first. The site loads, but anything that writes fails: form submissions, orders, logins.
Which partition is full? How do you check with df?
df -hT lists mounted filesystems with their type, size, used and free space. Note the row whose Use% is near 100% and its Mounted on column. Most VDS setups have a single root partition (/); if there is a separate /boot or /var partition, that is often the one that fills up. tmpfs and devtmpfs rows live in memory and have nothing to do with the disk.
- df -hT: size and usage of each partition.
- df -i: inode usage. If IUse% is 100%, no new file can be created even though the disk looks empty. Inodes are used up by large numbers of small files: PHP session files, cache directories, the mail queue.
- du -sh /var/log /var/lib/docker /var/cache /home 2>/dev/null: total size of the directories that fill up most often.
What is filling the disk? How do you find large directories and files?
Start at the root and step into the largest directory each time. The -x option keeps du on the same filesystem, so /proc and other mounted disks are left out:
- du -xh --max-depth=1 / 2>/dev/null | sort -h: sorts the directories under root by size, largest last. Run the same command in that directory (for example du -xh --max-depth=1 /var | sort -h) and keep going until you reach the files taking the space.
- find / -xdev -type f -size +500M -exec ls -lh {} + 2>/dev/null: lists files larger than 500 MB. Forgotten .sql dumps, .tar.gz backups and ISO images usually turn up here.
- ncdu -x /: the same scan in an interactive screen you browse with the arrow keys. If it is not installed and the disk is completely full, the install will fail too; free a few hundred MB first.
- du --inodes -x / 2>/dev/null | sort -n | tail: if inodes are the problem, shows the directories holding the most files.
What can you safely delete? Step-by-step cleanup
Know what a file is before you delete it. These steps free space on most servers without touching running services:
- systemd journal: journalctl --disk-usage shows how much space the journal uses. journalctl --vacuum-size=200M deletes old entries until the journal is down to 200 MB; to clean by age, use --vacuum-time=7d.
- Old logs: .gz files rotated by logrotate can be deleted with find /var/log -type f -name "*.gz" -delete. Do not rm a large log that is still being written; empty it with a command like truncate -s 0 /var/log/nginx/access.log instead. A file removed with rm keeps using space until the service writing to it restarts.
- Package cache: on Ubuntu and Debian, apt clean removes downloaded package files and apt autoremove --purge removes packages and old kernels that are no longer needed. On AlmaLinux and Rocky Linux the equivalents are dnf clean all and dnf remove --oldinstallonly.
- Docker: docker system df shows the space used by images, containers, volumes and the build cache. docker system prune removes stopped containers, unused networks, dangling images and unused build cache. Adding -a also removes every image no container uses. The --volumes option can delete volumes that hold database data; do not use it unless you know what they contain.
- Docker container logs: the default json-file driver writes logs to /var/lib/docker/containers/<id>/<id>-json.log with no size limit. You can empty an oversized file with truncate -s 0; the lasting fix is the log limit below.
- Database binary logs: in MySQL and MariaDB, do not delete binlog files under /var/lib/mysql by hand. Connect to the database and run PURGE BINARY LOGS BEFORE NOW() - INTERVAL 7 DAY; instead. If you use replication, first check that the replica has read those logs.
- Backups and dumps: move old backups piling up on the server somewhere else, or delete them. A backup on the same disk as the data is no help when that disk fails anyway.
Why didn’t deleting a file free any space?
On Linux, a deleted file stays on disk until the last process holding it open closes it. If you removed a large log with rm, Nginx, MariaDB or your application keeps writing to it and df shows the same usage. lsof +L1 lists these deleted but still open files with the process name, PID and size.
Restarting the service (for example systemctl restart nginx) frees the space. If you cannot stop the service, empty the file through the process: with the PID and FD from the lsof output, run : > /proc/PID/fd/FD. Leave out the letter in the FD column (the w in 4w) and use only the number.
There is one more reason df and du disagree: ext4 reserves 5% of the space for root by default, and df does not count it in the Avail column. That is why Used plus Avail comes out smaller than Size.
How do you keep the disk from filling up again?
- journald limit: set SystemMaxUse=500M in /etc/systemd/journald.conf, then run systemctl restart systemd-journald.
- logrotate: if there is no rule in /etc/logrotate.d for your own application’s log, add one (daily, rotate 14, compress and so on). logrotate -d /etc/logrotate.d/<file> tests the rule without changing anything.
- Docker log limit: add {"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "3"}} to /etc/docker/daemon.json and run systemctl restart docker. The setting applies only to newly created containers; recreate existing ones with docker compose up -d --force-recreate.
- Monitoring: set up an alert for when usage passes 85%. A small cron job that reads df --output=pcent / | tail -1 and sends an email or Telegram message above the threshold is enough.
- Backups: store backups off the server and keep only the last few locally.
- A larger disk: if, after cleanup, the disk is filling with data that genuinely grows, such as a database or user uploads, you need a larger disk. WeServer Turkey VDS plans range from 20 GB SSD to 200 GB SSD. How to size disk, CPU and RAM together is covered in “How much RAM and how many vCPUs does a VDS need? Sizing guide”.
What errors appear when the disk is full?
- “No space left on device”, but df -h shows free space. Cause: the filesystem is out of inodes. Fix: confirm with df -i and find the directory with the most files using du --inodes. It is usually a session or cache directory; clear old files with find <directory> -type f -mtime +7 -delete.
- MariaDB or MySQL will not start and the log shows “Errcode: 28 - No space left on device”. Cause: the database cannot write temporary files or logs. Fix: free space, start it with systemctl start mariadb and check with journalctl -u mariadb that the error is gone.
- “You don’t have enough free space in /var/cache/apt/archives/” during apt upgrade. Cause: the root partition or /var is full. Fix: apt clean and apt autoremove --purge.
- A kernel update stopped halfway and /boot is at 100%. Cause: old kernels have piled up on a small, separate /boot partition. Fix: note the running kernel with uname -r and remove the old ones with apt autoremove --purge; if the command fails because of the half-finished install, run apt -f install afterwards.
- “no space left on device” during docker build or docker pull. Cause: images and build cache under /var/lib/docker. Fix: check with docker system df, then clean up with docker builder prune and docker image prune -a.
- “(28: No space left on device)” in the Nginx error.log and 500 errors on large uploads. Cause: Nginx cannot write the request body to a temporary file. Fix: free space; if you use separate partitions, check the one holding Nginx’s temporary directory (/var/lib/nginx on Ubuntu and Debian).
Frequently asked questions
At what percentage does disk usage become a problem? Writes stop at 100%, but database maintenance, package updates and backups temporarily need extra space. Keeping usage under 80–85% leaves room for them.
Can I delete the whole /var/log directory? No. Some services will not start without their log directory, and you lose the records you need when something breaks. Delete old rotated files and empty large active logs with truncate.
Why do df and du show different sizes? Deleted files that are still open only show up in df, and the space ext4 reserves for root is not counted in Avail. If another disk is mounted over a directory, du cannot see the old files underneath it.
What should I do when the disk fills up on a Windows Server VDS? Run Disk Cleanup (cleanmgr) with “Clean up system files”, and in an administrator command prompt run Dism.exe /Online /Cleanup-Image /StartComponentCleanup to remove old update components. Large files tend to pile up in Downloads folders, IIS logs (C:\inetpub\logs) and old backups.
Can I grow the disk on WeServer without changing plans? Disk is part of the plan along with CPU and RAM; Turkey VDS and IPv6 Subnet VDS plans offer from 20 GB to 200 GB SSD. Ask the support team how moving to a larger plan works.
