Home > Uncategorized > Linux file copy benchmark cp vs cpio vs tar vs rsync

Linux file copy benchmark cp vs cpio vs tar vs rsync

July 19th, 2010

There are many commands to copy a directory in Linux. The difference between them in current Linux distribution are very small. All of them support link, time, ownership and sparse.

I tested them to copy a Linux kernel source tree. Each command I tested twice and keep the lower result.
The original directory size is 639660032 bytes. All methods generate exact same size of 675446784 bytes without sparse option.

Non Sparse Sparse
rsync rsync -a src /tmp rsync -a -S src /tmp
cpio find src -depth|cpio -pdm /tmp find src -depth|cpio -pdm –sparse /tmp
cp cp -a –sparse=never src /tmp cp -a –sparse=always src /tmp
tar tar -c src|tar -x -C /tmp tar -c -S src|tar -x -C /tmp

Time used and destination size:

Concolusion:
For non sparse copy, rsync is the fastest. For sparse copy, rsync and cpio have the best space efficiency, but slow.

Bookmark and Share  
 

Yejun Uncategorized

  1. No comments yet.
  1. No trackbacks yet.