User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

transfer_disk_with_netcat [2015/08/15 22:56] (current)
Line 1: Line 1:
 +Recently I had to move some VPSes from one server to another, as the old server was being shut down (new cheaper and faster host). To minimize the downtime, I took data from one LVM volume and put it directly in the LVM of the new server.
 +Receiving side:
 +<​code>​time nc -l 19000 | pigz -d -k -c - | dd of=/​dev/​vps-vg/​vps04</​code>​
 +  * I use "​time"​ just for stats (so it's not required)
 +  * I set up a listening netcat socket on port 19000, awaiting data from the "​sending side"
 +  * I decompress incoming data from netcat with pigz ("​-"​ is for data coming from "​stdin"​)
 +  * Finally I put the decompressed data into the new LVM volume with "​dd"​ (dd grabs its data from stdin if no "​if"​ parameter is set)
 +Sending side:
 +<​code>​dd if=/​dev/​vg0/​vps04 bs=4096k | pigz -9 -b 4096 -c | nc RECEIVING.SERVER.TLD 19000</​code>​
 +  * I read the data with dd
 +  * I compress it with pigz
 +  * I then use netcat to send the data.
 +**NOTE:** You need to start the "​receiving side" first, otherwise the "​sending side" will fail due to netcat being unable to establish a connection.
transfer_disk_with_netcat.txt ยท Last modified: 2015/08/15 22:56 (external edit)