Copying Filesystems
From Wikistix
Commands to copy a file heirarchy between two directories:
tar
tar Example
# cd /original/dir # tar -cf - . | (cd /new/dir && tar -xf -)
tar Notes
- '-p' option may be required to preserve permissions (say, on Tru64).
- '-C' option can often be used to remove the 'cd' for changing destination directory.
- '-l', '--one-file-system' non-standard options can be used to restrict tar to reading from the one filesystem. If not available, null or loopback mounts could be used.
- '-v' can be added to the second tar to list files as they are copied.
- Handling of sparse files, extended attributes (ACLs, BSD extended file flags, ...) and special files (fifos, character and block special files, named sockets, doors, ...) are all largely implementation defined.
pax
pax Example
# pax -rwpe /original/dir /new/dir
pax Notes
- '-v' option can be used to list files as they are copied.
- '-X' option can be used to restrict tar to reading from the one filesystem.
cpio
cpio Example
# cd /original/dir # find . -print | cpio -pdl /new/dir
cpio Notes
This article is a stub. Please expand it if you have more information.