Lets find out the cause and fix it.
List partitions and usage
df -h
Check Disk Usage per User
repquota -a -s
Show only accounts with usage in Gbytes
repquota -a -s | grep G
Check Disk Usage per Partition ignoring links
* You can replace /home with the parition or folder you want to check
Let’s check /home partition
du -hx --max-depth 1 /home
Show only folders with usage in Gbytes
du -hx --max-depth 1 /home | grep G
Check /var partition
du -hx --max-depth 1 /var
Show only folders with usage in Gbytes
du -hx --max-depth 1 /var | grep G
Check Mail folder /var/vmail
du -hx --max-depth 1 /var/vmail
Show only folders with usage in Gbytes
du -hx --max-depth 1 /var/vmail | grep G
Check MySQL folder /var/lib/mysql
du -hx --max-depth 1 /var/lib/mysql
Show only folders with usage in Gbytes
du -hx --max-depth 1 /var/lib/mysql | grep G
Check Backups
du -hx --max-depth 1 /backup
Show only folders with usage in Gbytes
du -hx --max-depth 1 /backup | grep G
Show only daily backup folder with usage in Gbytes
du -hx --max-depth 1 /backup/daily | grep G
Now when you know how to check the partitions and folders here are some useful commands to check files in the folder sorted by size:
ls -lahS /folder/location
Example for MySQL folder /var/lib/mysql/
ls -lahS /var/lib/mysql/
Some useful scripts we already have are checking the most frequent folders:
/var/log/
/usr/local/apache/logs/
/usr/local/apache/domlogs/
/usr/local/cwpsrv/logs/
/tmp
/root
/var/lib/mysql/
/scripts/disk_check
Delete Files
Now when you know how to check, the question is how can you delete or empty files.
Note that you shouldn’t delete files other than logs or backups as all others can crash your server.
Log files are in use by the programs so in case you want to clean big active log files you can’t just delete them as they will remain invisible until you restart the service.
The solution is to empty the file, example:
:> /usr/local/apache/logs/access_log
However all other logs files you can simply delete, examples
rm -f filename
An example case when you have active log files and logrotated which are not active and are renamed with -DATE
Delete single log file NOT currently in use by service
rm -f /var/log/maillog-20211108
Delete all maillog files NOT currently in use by service
rm -f /var/log/maillog-*
Empty active log file which is in use by the service
:> /var/log/maillog
* If you are not sure it’s better to grab a support service and have the experienced sysadmin to check this for you.