3 ms·
I love socat one-liners. Here's a quick one that I've been using to image new machines (data volumes only; I prefer puppet/chef/ansible for installing my OS and
by namecast 13y ago
I love socat one-liners. Here's a quick one that I've been using to image new machines (data volumes only; I prefer puppet/chef/ansible for installing my OS and configuring programs):
On the receiver, let's listen on an SSL socket and output the stream of data we receive to dd for writing to a partition:
socat openssl-listen:9999 | dd of=/dev/sdc1
Now on the sender, all we have to do is
dd if=/dev/sdb1 | socat - openssl:receivinghost:9999
And bam, /dev/sdb1 on the sender is imaged to /dev/sdc1 on the receiving host. Note that dd only knows to read what socat feeds it, so make sure nothing else is connecting to that socket or you'll get a weird image that fsck probably won't be able to save.
- sn 13y agoDepending on your available bandwidth, cpu etc. you may want to compress / uncompress inline. I just tried this locally: sudo dd if=/dev/sda2 | bzip2 | pv | bunzip2 | dd of=/tmp/tmp 204800+0 records out 104857600 bytes (105 MB) copied, 23.1976 s, 4.5 MB/s 84.6MB 0:00:27 [3.02MB/s] 204800+0 records in 204800+0 records out 104857600 bytes (105 MB) copied, 28.0081 s, 3.7 MB/s