/usr - Disk Management

HostingDirect

New member
I have a question, my server is linux using cpanel and over time I have noticed that my /usr directory has been getting larger (only 46% now). I was wondering as it gets larger what are the customary files that I should modify, move or delete to bring it back in line? What does anyone else using cpanel do when /usr get filled up?

/usr ext2 /dev/hda6 46% 962.77 MB 905.99 MB 1.92 GB

Thanks!
 
Curt said:
I have a question, my server is linux using cpanel and over time I have noticed that my /usr directory has been getting larger (only 46% now). I was wondering as it gets larger what are the customary files that I should modify, move or delete to bring it back in line? What does anyone else using cpanel do when /usr get filled up?

/usr ext2 /dev/hda6 46% 962.77 MB 905.99 MB 1.92 GB

Thanks!

The usual reasons, are log files and databases. If you don't have MySQL store databases in the /usr partition/directory tree, then you can ignore that, for now at least. As for the usual reason, cpanel defaults Apache to be stored at the common location Apache uses, which is /usr/local/apache. Likely, you have your Apache web server logs in /usr/local/apache/domlogs and /usr/local/apache/logs. (I'll quickly mention, that there's some logs somewhere in the /usr/local/cpanel directory tree too -- I don't recall where). Anyway, you can delete them (the Apache logs), but you'll probably want to hold onto them for as long as you can, and at least process them first. With any log file, it's text and compressing them is a good option, since it has such a high compression ratio. Finally, the other option, is to find a partition with lots of room (usually the /home partition has the most room on most servers). Create a directory in /home and call it whatever you want. Then stop the web server, stop the "chkservd" script too -- this will stop them from running while you move things around (because the chkservd script will start a service it thinks or sees is down). While they are stopped, move the directories of the 'domlogs' and 'logs' to the /home/newdirectory/ directory you created (be sure to use the -R option in 'mv', or it'll ignore the directory and any sub directories it might have within it). Once you do that, create symbolic links to the new target directory from the Apache directory (i.e., "cd /usr/local/apache; ln -s /home/newdirectory/domlogs domlogs; ln -s /home/newdirectory/logs logs". Then restart Apache and then restart the chkservd service. Another directory that often gets full faster, is the /var directory. You can do the same thing if you don't have a lot of room there.


Remember to check your permissions on the /home/newdirectory you create -- if applicable, and to shut down any of the relevant services to the programs that need to use these directory's to store PID files, or write log files -- especially in the case of MySQL -- you don't want it to write to a user's database while you're moving it or you'll just give yourself problems. Finally, log rotation is always good idea -- and you can have it automatically parse/process, compress, delete, compress new and delete old, etc. for the logs and you don't have to worry about what will happen if you don't remember to deal with this issue manually. Also, I hope that your server was set up well, because I see a lot of servers with one large / root partition or maybe the / root partition, /home (and maybe /usr too, but sometimes not), and nothing else. You should hopefully have a /tmp partition and one for /boot, for security reasons as well, not just for making sure that someone can't fill up a partition and mess up the entire operation of the server (not to mention drive access time, or also, that if the partition table corrupted or you had a bad drive area, it won't affect all the data on all the partitions like it would with only one or a fewer than you should otherwise have). Also, to have the partition scheme logically planned out. I.e., not having an 8 GIG drive and have 6 GIG's on a usually non-growing partition to have most of the space, while things like /var and/or /usr and especially /home have very little left. Just some stuff to be aware of -- I've actually refused lame installs before and told them to do it over, because everything was on one big / root partition. So, keep aware of what you're running on your server, you really should be, to be aware of all the different issues involved and how to plan to maintain it a little better in these aspects (you'll save yourself a lot of problems).
 
Last edited:
As a follow up based on a number of responses here is what I ended up doing to control my /usr size.

This is my process:

=============================
/usr - Log Management:

- SSH into your server
- Go into /usr/local/apache/domlogs
- type ls -alSH|more
- Select the largest log files. Either delete them, or tar them up.
- You must restart apache to clear the space out, otherwise they will not reset

This works for me :) Thanks to all for the input!
 
Top