[ILUG] Copying directory trees
chris.higgins at darach.ie
Tue Jan 27 10:08:54 GMT 2004
On 27 Jan 2004 09:19:25 +0000
Brendan Halpin <brendan.halpin at ul.ie> wrote:
> Say I want to move /usr/local to a new partition: what's the least
> error-prone way of doing the copy?
> cp to the new location, delete old, edit fstab, mount new partition?
> tar /usr/local, delete old, edit fstab, mount new partition, untar?
mount /dev/hda-new /usr/local2
tar -cf - * | ( cd /usr/local2 ; tar xf - )
mount /dev/hdanew /usr/local
You can add a 'v' argument to the second tar to see the progress
if you want. ( it adds comfort the first couple of times you do this )
I'm also assuming that there are no '.' hidden files in the /usr/local
directory itself because the first tar matches "*", so it won't catch
I'm also assuming that /usr/local is an existing partition and can be
unmounted. If it is a directory of the current /usr, then a simple
mv local local.old
mount /dev/hda-new /usr/local
will work. Any processes still using files in the old /usr/local will
continue to write to /usr/local.old until they restart.
Don't forget to update your /etc/fstab so that it all sticks together
> Brendan Halpin, Department of Sociology, University of Limerick,
> Ireland Tel: w +353-61-213147 f +353-61-202569 h +353-61-390476; Room
> F2-025 x 3147 mailto:brendan.halpin at ul.ie
> Irish Linux Users' Group
Chris Higgins Cisco Learning Partner
Darach Technology Ltd tel: +353-1-6204370
email: chris.higgins at darach.ie fax: +353-1-6204371
More information about the ILUG