Jamie Fargen's Weblog

How to copy sparse files faster?

by on Oct.11, 2012, under Work and stuff

A lot of people do backups with rsync and 99% of the time it works pretty well. There is one file type that rsync handles rather poorly and that is sparse files, even though rsyncs documentation indicates that sparse files are handled efficiently it is simply not true. These sparse files are becoming more prominent because they are used to store VM images, like KVM, Xen, even VMWare. So what is a good way to copy them? It turns out that tar is much better at handling sparse files than rsync, it has had support for sparse files for over two decades, and can represent the holes in sparse files more efficiently.

In my testing using Tar instead of Rsync has resulted in cutting the time to backup a sparse file by 8-10 times.

Just pipe tar over ssh and compare your results to rsync:
tar cvzSpf – sparse.file | ssh user@hostname ‘(cd /tmp; tar xzSpf -)’

 

:, , , , , , , , ,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...