Copying a filesystem from one disk to another would seem like an easy thing to do, and the tools to do it should be included and obvious. We get included, but not obvious.
If you just need to copy plain files, use any of the standard tools and skip the rest of this article. If you need to copy devices, hard links, and plain files with all of their permissions and attributes intact, you’re going to have trouble using
cp, tar, or cpio because they all have some deficiencies with special files.
Two tools that will preserve these things are
dd and dump but they have other limitiations and little flexibility.
So, what’s our savior tool?
rsync can do all of this, resume copies, run over the network, and probably make eggs and toast.
Here’s a good summary
from Bill Blun on the LVM list:
To copy data from one filesystem another, preserving hard links, I use: rsync -avxSHW /source-dir/ /target-dir -a same meaning as for “cp” i.e. recurse and copy metadata -v be verbose -x do not cross filesystem boundaries -S handle sparse files -H handle hard links -W only copy whole files Trailing slash on source-dir makes it copy *contents* of directory rather than directory itself. It only copies changed changed files. Be sure to use version 2.5.2 or higher of rsync.