Netcat Tar Pipe

Netcat Tar Pipe

Lets face it, sometimes we need to move massive amounts of data between servers. wouldn't it be great if it wasn't so darn slow? In some cases rsync would do the job just fine, but it gets slowed down when it has to do checksum checks before and after a file transfer. Sure you could turn off the checksum checks but you would still be limited by rsync.

Enter netcat tar pipe

we can use a combination of netcat, tar, and a pipe to blast data from one server to the other.

While copying files from an old NAS to a new NAS I was seeing the following transfer speeds.

Method Transfer Rate
rsync 5mb/s
netcat tar pipe 71mb/s

How to Run it

Receiver

On the receiving machine start a listener in the directory where files will be received.

cd /path/to/destination/directory
ncat -l -p 7000 | tar -xpf -

Sender

On the sending machine start a transfer to the listening receiver.

cd /path/to/source/directory
tar -cf - * | ncat <hostname_of_receiver> 7000

Synology

Synology NAS's do not have netcat installed by default and you will need to install the DiagnosisTool to get access to the binary. Run the following command on your synology machine to install netcat.

sudo synogear install