How to reduce space in /usr partition?

tedy

Registered
Oct 25, 2009
2
0
51
Hi,

There is similar thread, but I can`t find any useful information in it, so I've opened another one.
My /usr partition is filling up about 5% per day.

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.7G 6.6G 2.7G 72% /usr

The problem is that I have no idea where/which files are filling up.
I've deleted ALL logs in /usr/local/apache/domlogs but it caused like 1% of space.

Here are all files which exceed 20MB on /usr

/usr/lib/locale/locale-archive: 54M
/usr/bin/php: 20M
/usr/lib64/xulrunner-1.9/libxul.so: 23M
/usr/local/apache/modules/libphp5.so: 21M
/usr/local/apache/logs/error_log: 26M
/usr/local/apache/logs/access_log: 31M
/usr/local/cpanel/cgi-sys/php5: 20M
/usr/local/cpanel/cpanel: 31M
/usr/local/cpanel/whostmgr/bin/whostmgr5: 28M
/usr/local/cpanel/whostmgr/bin/whostmgr: 34M
/usr/local/cpanel/whostmgr/bin/whostmgr2: 35M
/usr/local/cpanel/whostmgr/bin/xml-api: 27M
/usr/local/cpanel/bin/wwwacct: 21M
/usr/local/bin/php: 20M

As you can see, there is no any big file like log or something.

I've also tried to set logs in rotation(WHM) but it didn`t help either. :(
 
Last edited:

tedy

Registered
Oct 25, 2009
2
0
51
I've just found out another strange think:

# du -sh /usr
3.3G /usr

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.7G 6.6G 2.7G 72% /usr


Any replies appriciated :confused:
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
13
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
I suggest using "du" to gradually search deeper levels of directories within the "/usr" partition.

The following command could be used as a starting point:
Code:
# du -ahx --max-depth=1 /usr
To check levels deeper, simply append more directory structure to the path, such as the following examples:
Code:
# du -ahx --max-depth=1 /usr/local
# du -ahx --max-depth=1 /usr/local/apache
# du -ahx --max-depth=1 /usr/local/apache/logs
# du -ahx --max-depth=1 /usr/local/cpanel/logs
I recommend reviewing the manual "man" page for "du" to become more familiar other options and usage examples:
Code:
# man du
 

InstaCarma_Tech

Well-Known Member
Apr 22, 2009
227
1
68
Hope this helps :

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.