Video in progress
The server's disk is full and the application cannot write. How do you find what is taking the space?
I use df -h to see which partition is full, then du -sh to find which folder is big. On Java servers the culprit is often unrotated logs, heap dumps or old Docker images.
📖 Answer
df -h # which mount is at 100%
sudo du -xh --max-depth=1 / | sort -h # biggest folders
sudo du -sh /var/log/* | sort -h | tail
docker system df # size of images, containers, volumes
find / -xdev -name "*.hprof" -size +100M 2>/dev/null
The classic culprits:
app.logwas never rotated and has grown to 40 GB;-XX:+HeapDumpOnOutOfMemoryErrorleft a multi-gigabyte.hprofon every OOM;- Docker kept old images and stopped containers:
docker image prunehelps.
There is one trap: you rm the log, but df still shows 100%. The reason is that the Java process still holds the file descriptor, and the disk space is not freed until the process is closed. lsof +L1 shows such "deleted but still open" files. Instead of deleting the file, it is safer to empty it: truncate -s 0 app.log.
The long-term fix is a rolling policy in logback (maxFileSize, maxHistory, totalSizeCap) or sending logs to stdout.
Sign up to mark studied questions and save your progress.