It’s quite common for sites to go down because the servers they are hosted on are running out of disk space or even worse, running out of disk inodes! Let’s take a quick look at how to check your disk space and a command to quickly grep the inodes
1. First of all log into your server using SSH – the default SSH port is 22, but it is HIGHLY recommended to change this on all of your servers, more about that later
df -h to see the remaining disk space
3. As you can see there is only about 28% disk space left on the mount “usr” which is a critical mount
4. Next, let’s check the inodes. If you run out of inodes it’s possible critical services like apache or even SSH stop running properly. I managed to lock me out once because I completely forgot about disk inodes. Inode limits basically put a limit on the number of files on your hard drive. You can fill a disk quickly by copying lots of small files like log files and audits.
5. To quickly free disk inodes I recommend to check directories
/var/cache /var/logs /usr/local/apache/logs and most log file directories.
Also, if you have any special tracking tools or security tools like mod_security then you should regularly clean out the audits folder. Typically you can check where mod_security stores audits at /usr/local/apache/conf/modsec2.user.conf or in that directory
6. Use this command to quickly find large files on var:
find /var -type f -print | xargs ls -l | sort -k5,5rn | head