Link to home
Start Free TrialLog in
Avatar of ray-solomon
ray-solomonFlag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ray-solomon

ASKER

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
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
Avatar of Tintin
Tintin

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