[ale] moving /var

Christopher Fowler cfowler at outpostsentinel.com
Mon Feb 19 12:21:18 EST 2007


On Mon, 2007-02-19 at 12:02 -0500, Paul Cartwright wrote:
> I have a need to increase the size of a /var partition for someone. 
> I've got info on adding the new drive, creating partitions, adding to fstab, 
> relabeling partitions. What I'm not sure about is an active system partition 
> like /var . Once I create the new partition on the new drive, will I have a 
> problem copying all the files from /var to the new drive while the system is 
> running? Will putting it in single user mode work?

1.  Go into SU mode
2.  Create tarball of /var. 
    tar --same-owner -cjpsvf /tmp/var.tar.bz2 /var
3.  Make new FS
4.  edit fstab to include new FS on /var
5.  Mount /dev/XXX onto /var
6.  untar the file created in #2
    cd /var; tar --same-owner -xjpsvf /tmp/var.tar.bz2

Notes:
To free up space on / do the following between stesp 4 and 5 above.
4.5.  rm -rf /var/*

To speed the steps above you could simply do a mv like this
mke2fs .... /dev/XXXX
mount /dev/XXXX /mnt/tmp
mv /var/* /mnt/tmp
umount /mnt/tmp
mount /dev/XXXX /var



> 
> any other gotchas I should know about?
> this is a RedHat 3 update 6 Enterprise server.
> 
> thanks,




More information about the Ale mailing list