Thanks to all who answered--I got two replies before the message arrived
from the list!
1. Add "p" in the source tar call, so
cd /my/source/dir; tar cpvf - . | (cd /my/dest/dir; tar xpf -)
2. Use vdump/vrestore (this is the solution we used, and it worked great),
so
vdump -0 -f /sourcedir | (cd /destdir; vrestore -x -f -)
One person note there is a good example of this in the vdump man pages for
future reference.
3. Use gnu tar--has more options.
4. Use cpio and/or rsync, so
cd /my/source/dir; find . -mount -print | cpio -pdum /my/dest/dir
rsync -ax /my/source/dir/ /my/dest/dir
5. Use cp -rp.
6. Issue may disappear upon completion of tar/untar--root owns directories
in the interim (we did not se this behavior, but others noted there are
many versions of tar out there).
7. Ensure suid bit not set for group access in destionation tree.
Our original question is below:
I'm trying to copy a directory tree from one place to another using (as
root):
cd /my/source/dir; tar cvf - .| (cd /my/dest/dir; tar xpf -)
File permissions are coming across fine, but all directories in the
destination tree are owned by root. The owner owns the "dest" directory in
the example, and can create a directory in /my/dest/dir with mkdir.
All suggestions greatly appreciated.
Received on Wed Feb 20 2002 - 16:21:18 NZDT