Thursday, 11 February 2010

/usr Space issue

Want to know why is the server showing a difference in the usage of the /usr directory. df -h shows 6.9 GB used and du -h shows 4.8 GB used. Where did the 2.1 GB space go?


root@server [/usr]# du -h --max-depth=1 /usr

12K /usr/etc

2.8G /usr/local

262M /usr/bin

34M /usr/include

940M /usr/share

76K /usr/doc

24K /usr/X11R6

47M /usr/sbin

16K /usr/lost+found

21M /usr/libexec

608M /usr/lib

91M /usr/src

8.0K /usr/games

116K /usr/man

1.6M /usr/kerberos

4.8G /usr


The above shows 4.8 GB is the usage in /usr directory.

root@server[/usr]# df -h


Filesystem Size Used Avail Use% Mounted on

/dev/sda5 7.8G 1.2G 6.3G 16% /

/dev/sda8 424G 114G 288G 29% /home

/dev/sdb1 452G 243G 186G 57% /backup

/dev/sda6 996M 73M 871M 8% /tmp

/dev/sda3 7.8G 6.9G 519M 94% /usr

/dev/sda2 9.7G 8.6G 654M 94% /var

/dev/sda1 122M 16M 100M 14% /boot

tmpfs 1.8G 0 1.8G 0% /dev/shm


This shows 6.9 GB is the usage in /usr directory. How can there be such a huge difference in the disk usage? Which one is the real disk usage and how can we match both the disk usage shown?


1. Restart the httpd service. This might free a little space some times.

2. Check for apache logs like error_log, access_log , suexec_log in /usr/local/apache/logs . These can either be cleared off or if you need the logs then you can take a zipped copy and keep it aside.

3. Same can be done for the files in cPanel logs (/usr/local/cpanel/logs) as well .

4. Domlogs – Get into the /usr/local/apache/domlogs/ directory. Run the following command :-

# ls -al -SR | head -10 —> It will list 10 files in the decreasing order according to their size

If the domlog file is too large for a domain then it is possible that awstats is not running . Check whether cpanellogd is running on the server using pstree . If not, restart it .

Else, it is possible that awstats for only that particular domain is not updating. Get into the directory /usr/local/cpanel/base and check if any file as ‘awstats.domainname.com.conf’ exists. If yes , delete that file.

Now, run /scripts/runweblogs for that user. It will update the awstats and automatically clear the domlogs file thereafter. Do not delete the domlogs file itself.

5. Remove old and unwanted backups of ‘apache’ that might have been taken long ago. Also, check for any other duplicate folders that can be removed safely.

6. Remove core files, if any . Normally, some core files (like core.1234) might be present in /usr/local/cpanel/whostmgr/docroot . Check for these and remove them.

Want to know why is the server showing a difference in the usage of the /usr directory. df -h shows 6.9 GB used and du -h shows 4.8 GB used. Where did the 2.1 GB space go?


Try to check the error_logs, access_logs and size in /usr/local/apache/logs if its too larger then you can remove it by using command,

# echo > error_logs

# echo > access_logs

A reboot will fix it.

No comments:

Post a Comment