1

From manpage of rsync,

-a, --archive

This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission). The only exception to the above equivalenceis when --files-from is specified, in which case -r is not implied.

Note that -a does not preserve hardlinks, because finding multiply-linked files is expensive. You must separately specify -H.

What is the closest for cp to rsync -a, in terms of input and result of file copy, ignoring transfer speed?

What does cp -arl miss compare to rsync -a? Only -D of rsync?

Does cp -arl behave the same as rsync -a except those aspects it misses?

Thanks.

3

Note that rsync -a also doesn't preserve ACLs, extended attributes, hard links (as already noted), sparseness.

With GNU cp at least

cp -a

Preserves all that so does more than rsync. A closer rsync equivalent would be

rsync -aAHX

I don't think rsync can replicate the sparseness, but you can use --sparse so that sequences of NULs (whether they are allocated or holes) turn into holes in the destination.

Note that the (non-standard) -a option of cp implies -r. -l (another non-standard option), assuming GNU cp doesn't do what you want. It makes hard links instead of copying files.

  • Thanks. the cp I mentioned is from coreutils. – Tim May 15 '18 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.