Compress stream when copying linode disk image over ssh
the tutorial for copying a disk image over ssh
The command shown in the tutorial does not do any compressing:
ssh root@123.45.67.89 "dd if=/dev/xvda " | dd of=/home/archive/linode.img
Is it possible to compress the stream of data that is transferred from the linode to the receiving machine before it is being sent and then decompress it locally before it's passed to the dd?
What would the revised command need to be?
Thanks!
Torsten
5 Replies
ssh -C root@123.45.67.89 "dd if=/dev/xvda " | dd of=/home/archive/linode.img
The -C adds ssh compression.
> Requests compression of all data (including stdin, stdout,
stderr, and data for forwarded X11 and TCP connections). The
compression algorithm is the same used by gzip(1), and the
``level'' can be controlled by the CompressionLevel option for
protocol version 1. Compression is desirable on modem lines and
other slow connections, but will only slow down things on fast
networks. The default value can be set on a host-by-host basis
in the configuration files; see the Compression option.
So you can change the compression performance. Of course it depends what you're transferring if you're transferring a large MySQL database for example the -C flag on it's own vastly improves performance. I have my ssh_config file turn compression on my default.