Copy a filesystem from one computer to another using tar and netcat

If you need to transfer an entire filesystem from one machine to another, for example, when you get a new computer, do the following steps.

cd /mnt/sda1
tar -czpsf - . | pv -b | nc -l -p 3333
cd /mnt/sda1
nc 192.168.1.4 3333 | pv -b | tar -xzpsf -

The nc (netcat) command is used for any kind of TCP connections between two hosts. The pv (progress viewer) command is used to display the progress of the transfer. tar is used to archive the files on the source machine and un-archive them on the destination.

~~LINKBACK~~ ~~DISCUSSION~~