Friday, June 30, 2006

Block Device copying over LAN (Using Linux LiveCD)

To copy an entire block device or a single partition from one machine to the other over the network, use the following procedure :

  • Make sure the ssh daemon is running on the target machine.
  • Make sure the ssh daemon is running on the source machine.
  • Execute the following dd (1) command on the source machine.
dd if=/dev/hda bs=1k conv=sync,noerror | gzip -c | ssh -c blowfish user@hostname "gzip -d | dd of=/dev/hda bs=1k"

You can also use the great g4u (2) project that is based on BSD and is amazing in it's simplicity and usefulness.




Good for 1-to-1 copy of server machines, great for rapid restore in case of a crash.
Also can be used for intrusion detection analyses: Just copy the hard drive and use all the the data analyzing software you want on the clone, knowing that the original hard drive is still intact.



Reference :

1. http://www.inference.phy.cam.ac.uk/saw27/notes/backup-hard-disk-partitions.html
2. http://fbim.fh-regensburg.de/~feyrer/g4u/