Moving /var to a new volume.

Kim Holburn kim.holburn at anu.edu.au
Thu Jun 6 18:36:22 EST 2002


At 5:34 PM +1000 2002/06/06, Chris Fletcher wrote:
>I am sure this has happend to many people at some time or another.  We have
>a freeBSD server and the /var volume has filled up.  We have plenty of room
>on the /usr volume so we would like to move it to there.
>
>Can anyone point me in the right direction on how to acheive this without
>destroying the server :-)

A couple of things to remember.  The main reason that var is on a separate partition is to protect var from being on a full partition.  For instance, if you have it on the same partition as the home directory and someone fills the home directory then var becomes full and the system grinds to a halt.


You can sort of do it live but it is a bit tricky.  You can relocate say /var/log like this: copy all the contents of /var/log to say /usr/var/log (rsync is better for this) then re rsync a couple of times, then use a single set of commands on a single line like this:

cd /var; mv log log1; ln -s /usr/var/log . 

Rebooting or at least restarting syslogd  might help at this point.

If you want to do the whole of /var and /var is a mount point then you will probably have to reboot into single user and do stuff.  Remember to edit /etc/fstab to take out the /var mount point before you reboot.
-- 
--
Kim Holburn  Network Consultant  P: +61 2 61258620 M: +61 0417820641
Email: kim.holburn at anu.edu.au - PGP Public Key on request

Life is complex - It has real and imaginary parts.
     Andrea Leistra (rec.arts.sf.written.Robert-jordan)




More information about the linux mailing list