Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Running linux. I have two identical drives mounted on the same machine. What is faster CP, MV, or RSYNC? Why is one faster than the other? Are there any faster alternatives?

share|improve this question

closed as not constructive by mdpc, Chris S Feb 16 '12 at 17:55

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Might want to ask this in the UNIX group. –  mdpc Feb 16 '12 at 17:52

2 Answers 2

up vote 3 down vote accepted

When the source and destination are mounted on different partitions, cp and mv will perform about the same, since mv cannot optimize anything.

rsync offers advantages when you are doing an incremental transfer (such as when doing a daily backup), or when the destination is very remote and/or communication is unreliable (such as over the Internet).

rsync also provides a nice running progress bar if that's your thing :)

You can benchmark both mv and rsync, but rsync will report transfer times and speeds itself, while you will have to time mv and then calculate the speed afterwards.

share|improve this answer

I'd argue for cp being the fastest, even if marginally so.

Between drives, 'mv' should essentially amount to cp + rm (copy to destination, then delete from source). On the same filesystem, 'mv' doesn't actually copy the data, it just remaps the inode, so it is far faster than cp.

Rsync will be slower than cp since, it still needs to copy the entire file - and it has additional overhead (even if minor in this case). Rsync may win in the case where you already have the majority of data one the target drive and would only need to copy a small delta.

There is a somewhat of a comparison of the 3 here.

share|improve this answer

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