Thursday, April 10, 2008

Mirroring Trees: rsync --archive vs. cp -a

I did a quick, informal test, and it looks like cp -a is actually faster than rsync --archive for copying hierarchies.

Even this works fine:
$ cd /dev
$ sudo cp -a zero foo

[sudo] password for jsh:
$ ls -l zero foo
crw-rw-rw- 1 root root 1, 5 2008-03-20 20:05 foo
crw-rw-rw- 1 root root 1, 5 2008-03-20 20:05 zero
$ head /dev/foo | od -c
0000000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
Go figure. It's a long way from the old tar piped to tar.

No comments: