I'm currently trying to move a fairly empty, fresh qcow2 image from one system to another that's far away. I've basically got a fresh install of ubuntu LTS (real size 6gb, apparent size 200gb). Most file transfer methods (rsync over ssh) and sftp with duck attempt to transfer over 200gb.

This is inefficient since the disk image isn't actually using 200gb (just that it might, eventually). What would I need to do to transfer only what's used by the VM?

Both ends of the transfer run fedora 22, and I'd ideally not want to switch disk image formats, tho that would an option. Speed would be nice - I don't want to trade off transfer time for processing time.


rsync actually handles sparse files. When you say real size of 6GB and apparent size is 600GB, do you mean that du -h IMAGE.qcow2 shows "6G" but du -h --apparent-size IMAGE.qcow2 shows "200G"?

If so, you can add the -S flag to rsync to make it transfer files sparsely, meaning that you'll be sending over 6GiB of data instead of 200GiB.

It also sounds like your qcow2 image is not compressed. If you have the CPU resources to spare and your bandwidth is less than how fast your CPU can gzip, you can also pass the -z flag to rsync, which has rsync compress its file transfer as well.

I've got a fire-and-forget hotkey for rsync based off of this Super User question and it makes efficient and preservative file transfers most of the time: rsync -avzHXShPs

  • .... Yes, that's exactly what I mean, and probably what I need. – Journeyman Geek Jun 12 '15 at 3:52
  • the -z flag seemed to work the best. I didn't actually end up using the qcow2 image I transferred, and managed to solve the underlying reason for transferring that image so... meh. Useful thing to know in future in any case ;p – Journeyman Geek Jun 13 '15 at 1:53

scp -C uses compression, which should be pretty efficient for such a sparse file. One advantage is that you'd get a ready-to-use file at the destination.

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.