Linux server is running out of disk space. Need to identify which files take most of it.
- First of all need to identify which disk partition is running out of space. This can be displayed in very clear human readable format by using “df” command:
Identify partition which has highest percentage of usage – column “Use%” and check where it is mounted on. This folder is your starting point for the next steps. In the following sample there is a root partition mounted to root folder, which is 93% used. Thats not yet critical as there are still 11GB of available space. If you already facing issues regarding disk space, percentage of usage most probably will already indicate close to 100%.
- After identifying disk partition, we already know in which folders makes sense to look for most hungry disk space consumers. Use “du” tool to display files and folders with recursively summed up content capacity. It also sorts result for better readability:
du -sk * | sort -nr
- Go into each largest folder and repeat step 2. Use step 2 and 3 till you find files which consumes much of disk space and potentially are redundant and can be deleted (i.e. log files).
In case there is everything fine with disk space, maybe there is an issue with RAM? Here is how to check that – How to check memory (RAM) usage in Linux?