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.
Answer
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
No comments:
Post a Comment