dd if=/dev/vg/lv-1 | ssh other-server "dd of=/dev/vg/lv-1"
Now of course this is simple, but unfortunately not that good, because if this volume is 2 GB, then we generate 2 GB network traffic, we can try with compression:
dd if=/dev/vg/lv-1 | gzip -N | ssh other-server " gzip -d | dd of=/dev/vg/lv-1"
And now the question is: what should that N be? I have always used 9, but is it that much better than 8?
Centos 7 root filesystem
A blank ext4 filesystemNow this is the case, where the compression is quick yet I am not satisfied. The problem is that dd does not have a way to skip empty blocks, those too will be transferred. Can gzip help?
That nice drop between 3 and four is interesting. But is it worth waiting 3 seconds to save 7MB transfer? If it does, then your network sucks. Most of the time gzip -1 will do just enough.
ConclusionMore than 5 does not improve significantly on the compression, but comes with a great cost.
gzip -1 may be the best option when we know that the filesystem is mostly empty.
But in any case, an optimization should look for something better than gzip :)