Two partitions getting full

I have a web/db server with 4 drives on raid10.

The /usr and /var partitions are getting full.

Should I move /var and /usr to /home and symlink back to them or is that not recommended.

What do you recommend based on best practices.


Filesystem          1K-blocks             Used             Available    Use%     Mounted on

/dev/sda5            8123168          644292            7059584        9%     /
/dev/sda8        247004276      13293172        220961520        6%     /home
/dev/sda6            1019208          420536              546064      44%     /tmp
/dev/sda3            8123200        6292376            1411528      82%     /usr
/dev/sda2          10154020        6997620            2632280      73%     /var
/dev/sda1              124427            22440                95563      20%     /boot
tmpfs                   2021744                    0            2021744        0%     /dev/shm


Operating System: CentOS 5 (64-bit)
Processor: 4 x Quad Core - Intel Xeon E5335
Hard drive: 4 x 15K rpm SAS 147 GB
RAM: 4 GB
LVL 10
ray-solomonAsked:
Who is Participating?
 
TintinConnect With a Mentor Commented:
/usr should be an almost static filesystem, so not much need for worry there.

/var is generally your most active filesystem as that's where all the logs/mail etc are written to.

Ideally, you should resize your /home and /var filesystems, but if you don't want to go through that process, you could move some of the stuff out of /var into /home and create a symlink.

0
 
ray-solomonAuthor Commented:
Would you please see my commands below and make sure I did not miss anything?

I am first going to do this on my testing server of course.

cp /var /home

cp /usr /home

mv /var /var/old_var

mv /usr /usr/old_usr

cd /var

ln -s  /home/var /var

cd /usr

ln -s  /home/usr /usr

And then when I think everything is working fine, I could delete (rm -rf) /var/old_var and /usr/old_usr
0
 
ray-solomonAuthor Commented:
I modified it, and think this is a better way

cp -r /var /home
cp -r /usr /home

mkdir /var/old_var
mkdir /usr/old_usr

mv /var/* /var/old_var
mv /usr/* /usr/old_usr

cd /var
ln -s  /home/var /var

cd /usr
ln -s  /home/usr /usr
0
 
TintinCommented:
I really wouldn't recommend playing around with /usr as you get into trouble when you start trying to move things around.

As for /var, you should ideally move things in single user mode to reduce the number of processes writing to files.

What I would recommend is moving your largest directory under /var (eg: /var/log) to /home and do

mkdir /home/var
mv /var/log /home/var
ln -s /home/var/log /var/log
/etc/init.d/syslog restart
/etc/init.d/cron restart
/etc/init.d/xinetd restart

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.