How to Manage Your Hard Drive Space
Valid for versions 94 through the latest version
Last modified: December 2, 2022
This document provides steps to help you to manage your server’s hard drive space.
We strongly recommend that you keep at least 10% of your server’s available disk space free.
Examine disk space usage
To examine your system’s disk space usage, run the following command:
The output will resemble the following example:
This output indicates that the system’s main storage device (
/dev/mapper/LogVol00) in the root (
/) directory uses 70% of its available disk space and contains 85 GB of free space.
Examine disk space usage by file and directory
If your system currently uses too much disk space, perform the following steps to identify files to delete:
To determine which files and directories consume most of your hard drive space, run the
ducommand. The output will resemble the following example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
372K ~ 107M etc 113 G home 253M lib 20K LICENSE 2.6M locale 16K lost+found 64K mbox_backup 8.0K media 8.0K mnt 418M opt 0 proc 12M pub 4.0K pub-htaccess.txt 648K templates 14K tmp 64K tools 5.4G /varNote:
- We recommend that you only run this command in off-peak hours to prevent additional load on your server.
- The numbers in the left column represent the sizes of the files and directories that the working directory contains, in human-readable format.
/homedirectory, which generally contains the system’s cPanel account data, uses the most disk space (113 GB). Because in most cases you cannot delete your users’ data, examine the second largest directory (the
/vardirectory) for disk usage data.
To examine the desired directory, run the following command:The output will resemble the following example:
du -sh /var/*This output indicates that the `/var/logs/` directory uses the most disk space.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
12K /var/account 4.0K /var/aptitude 28K /var/aquota.user 938M /var/cache 559M /var/cpanel 4.0K /var/cvs 24K /var/db 32K /var/empty 8.0K /var/games 173M /var/lib 8.0K /var/local 36K /var/lock 3.7G /var/log 0 /var/mail 10M /var/named 8.0K /var/nis 8.0K /var/opt 44K /var/portsentry 8.0K /var/preserve 144K /var/profiles 16K /var/proftpd 16K /var/proftpd.delay 4.0K /var/proftpd.pid 4.0K /var/proftpd.scoreboard 8.0K /var/quota.user 8.0K /var/racoon 1.2M /var/run 16M /var/spool 4.0K /var/state 14K /var/tmp 4.0K /var/vzquota 44K /var/www 20K /var/yp
Repeat this process until you locate files that you wish to remove.
To delete the desired files, run the following command, where
filenamerepresents the file to remove:
rm -f filenameWarning:
Exercise caution when you run the rm utility. You cannot recover files or directories that you delete.
Retain log entries
Log files often use a large amount of disk space. To retain the system’s most recent log file entries when you remove excess log files, perform the following steps:
- If you have not already located the specific files to remove from this directory, run the
- Examine the command’s output to determine the files to delete.
- For each file, run the following commands, where filename represents the file’s name.
tail -5000 filename > filename.new mv filename.new filename sync
- To release the file lock, restart the service that created the file.
Self-Monitoring, Analysis and Reporting Technology (SMART) errors may indicate hard disk failures or other problems. Only disable SMART errors if you understand these risks.
To disable SMART errors, run the following commands:
Monitor disk space usage
To monitor disk space usage, enable the System disk space usage warnings setting in WHM’s Tweak Settings interface (WHM » Home » Server Configruation » Tweak Settings).
To disable notifications for specific mount points, add them to the