This document will provide a step by step solution to help you to manage your server’s hard drive space.
It is strongly recommended that you keep at least 10% of your server’s available disk space free.
If you want to examine your system’s disk space usage, you can run the following command:
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.
If you find that your system currently uses surplus disk space, you can simply perform the following steps to identify files to delete:
The output will somewhat show itself in the following example:
113 G home
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.
|du -sh /var/*|
The output will show itself in the following manner:
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.
|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.
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:
|tail -5000 filename > filename.new|
mv filename.new filename
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: