Examine disk space usage

If you want to examine your system’s disk space usage, you can run the following command:

df -h


After doing this the output will result in 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


Please remember that 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 you find that your system currently uses surplus disk space, you can simply perform the following steps to identify files to delete:


If you want to determine which files and directories consume most of your hard drive space, you can run the du

The output will somewhat show itself in the following example:

372K   ~
107M   etc

113 G home

253M   lib


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




It is highly recommended that you onlyrun this command in off-peak hours so that you can prevent additional load on your server.

Please note that the numbers in the left column represent the sizes of the files and directories that the working directory contains, in human readable format.

In the example shown above, the /home directory, which, in general, contains the system’s cPanel account data, uses the most amount of disk space (113 GB). The reason is that in most cases you cannot delete your users’ data or examine the second largest directory (the /var directory) for disk usage data.


If you want to examine the desired directory, you can run the following command:

du -sh /var/*

The output will show itself in the following manner:


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 generally indicates that the /var/logs/ directory uses the most amount of disk space.



It should be noted that log files use disk space quickly. If you want to retain recent log file entries, you can perform the additional steps in the Retain log entries section below.


You can repeat this process till you locate the files you want to remove.

If you want to delete the desired files, you can simply run the following command, where filename  will represent the file you want to remove:

rm -f filename



Please remember to Exercise extreme caution when you run the rm utility as you will not be able to recover files or directories that you delete.


Retain Log Entries

It should be noted that log files often use a large amount of disk space. If you want to retain the system’s most recent log file entries when you end up removing excess log files, you can perform the following steps:


Run the command, if you have not yet located the specific files to remove from this directory.

You can then examine the command’s output to determine the files to delete.

After that, for each file, you can run the following commands, where filename represents the file’s name.


1. tail -5000 filename > filename.new

2. mv filename.new filename

3. sync

4. If you want to release the file lock, you can restart the service that created the file.


SMART Errors



Please note that Self-Monitoring, Analysis and Reporting Technology (SMART) errors may indicate hard disk failures or other problems. Only disable SMART errors if you understand and acknowledge these risks.


 If you want to disable SMART errors, run the following commands:

1   touch /var/cpanel/disablesmartcheck

2   /scripts/upcp




Was this answer helpful? 0 Users Found This Useful (0 Votes)