Why is my Linode running out of disk space?
I am unable to start Apache because I no longer have enough disk space. Can you help me understand what is going on?
1 Reply
There are many things that can slowly eat away at your disk space. A few of these are:
Log Files
If you look in your /var/log directory you may see files that slowly grow and grow and will use your space unless you regularly prune them back. If you have a log file that is getting too big, it is often filling up with the same warnings or errors. It is often a good idea to address the source of these warnings as they will slow down the growth of your log file and make your system more stable.
Uploads
You may be allowing users to upload images or content to your web server and this could be eating away at your space
Temporary Files
Applications may create temporary files again and again while may eat up all your space over time. Deleting these files will often free up a lot of space.
How to identify where your disk usage went
First you will want to see which partitions are most full, so run the df -h
command. Once you have see which filesystem is using the most space, you can replace
du -hxsP --max-depth 3 <dir>/* 2>/dev/null
which will recursively scan each <dir> to 3 levels down, printing the results in (h) human readable form, (x) staying in the filesystem, (s) summarizing, and (P) avoids following symlinks to prevent duplicates.
You may find that some of the space is still unaccounted for which can be because programs that are running may still be writing to files that have been deleted. You can use lsof | grep "(deleted)"
to find such files. Rebooting your Linode will remove these.