User Tools

Site Tools


gentoo:netcat_disk_copy

Differences

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

Link to this comparison view

Next revision
Previous revision
gentoo:netcat_disk_copy [2010/01/26 10:29] – created devagentoo:netcat_disk_copy [2013/10/28 08:19] (current) deva
Line 1: Line 1:
 ======Netcat disc copy====== ======Netcat disc copy======
 +NOTE: The netcat binary can be compiled with the 'static' useflag, thereby making it a standalone binary with no lib deps. (Can be copied to a livecd and run from there).
 +
 =====Copy an entire partition===== =====Copy an entire partition=====
 The client is a computer with ip 192.168.0.10.\\ The client is a computer with ip 192.168.0.10.\\
Line 23: Line 25:
 The server (the computer on which the disc to be copied resides) must run the following as root: The server (the computer on which the disc to be copied resides) must run the following as root:
 <code bash> <code bash>
-tar cvj . | nc -q 0 192.168.0.10 10000+tar --preserve -cvj . | nc -q 0 192.168.0.10 10000
 </code> </code>
  
Line 31: Line 33:
 The client (the computer on which the image is to be stored) must run the following as someuser: The client (the computer on which the image is to be stored) must run the following as someuser:
 <code bash> <code bash>
-nc -l -p 10000 > files.bz2+nc -l -p 10000 > files.tar
 </code> </code>
  
 The server (the computer on which the disc to be copied resides) must run the following as root: The server (the computer on which the disc to be copied resides) must run the following as root:
 <code bash> <code bash>
-tar cv . | nc -q 0 192.168.0.10 10000+tar --preserve cv . | nc -q 0 192.168.0.10 10000
 </code> </code>
  
 +=====Restoring files from tar=====
 +Assuming the server (the computer to have its files restored) has ip 192.168.0.59\\
  
 +On the client (the computer containing the backed up files) run the following:
 +<code bash>
 +nc -l -p 10000 | tar --preserve -xvf -
 +</code>
 +
 +On the server, change to the directory into which the files should be restoed and run the command:
 +<code bash>
 +cat files.tar | nc -q 0 192.168.0.59 10000
 +</code>
 +
 +=====Restoring partition from tar=====
 +TODO
 +
 +=====Restoring disk from bz2 archive=====
 +Sender:
 +<code>
 +bzcat -d centos_6.4_minimal_desktop.dd.bz2 | nc -q 0 192.168.0.51 10000
 +</code>
 +
 +Receiver:
 +<code>
 +nc -l 10000 | dd of=/dev/sda
 +</code>
gentoo/netcat_disk_copy.1264498147.txt.gz · Last modified: 2010/01/26 10:29 by deva