This document provides steps to help you to manage your server’s hard drive space.
Warning:
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:
df -h
The output will resemble the following example:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/LogVol00 288G 189G 85G 70% /
/dev/sda1 99M 47M 48M 50% /boot
tmpfs 252M 0 252M 0% /dev/shm
/usr/tmpDSK 485M 11M 449M 3% /tmp
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:
.1To determine which files and directories consume most of your hard drive space, run the du command. The output will resemble the following example:
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 /var
Note:
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.
In this example, the /home directory, 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 /var directory) for disk usage data.
.2To examine the desired directory, run the following command:
du -sh /var/*
The output will resemble the following example:
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
This output indicates that the `/var/logs/` directory uses the most disk space.
.3Repeat this process until you locate files that you wish to remove.
.4To delete the desired files, run the following command, where filename represents the file to remove:
rm -f filename
Warning: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:
.1If you have not already located the specific files to remove from this directory, run the du command.
.2Examine the command’s output to determine the files to delete.
.3For each file, run the following commands, where filename represents the file’s name.
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:
touch /var/cpanel/disablesmartcheck
/scripts/upcp
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).