dd Across The Internet With ssh and xz

23 Mar 2012

Here’s how you can back up an entire hard disk across the internet (compressed with xz to save as much bandwidth as possible, also using pv for progress):

$ ssh -p 2222 [email protected] 'dd if=/dev/xvda1 | xz -c' | pv > sonzonaroot.img.xz

To view your files on the other end:

$ xz -d sonzonaroot.img.xz
# mkdir /mnt/disk
# mount -o loop sonzonaroot.img /mnt/disk

You can always not xz the image up if you happen to be limited by CPU or RAM, rather than bandwidth.

Happy dd‘ing!

blog comments powered by Disqus