How to duplicate a complete PC via network
This documentation started in 2001 when standard hard discs often still were
measured in MB (MegaBytes) instead of GB. For today's discs approaching
TerraBytes you'll need a sufficiently sized network: transferring TBs we're
talking about hours or days when using a 1 Gbit/s or 100 Mbit/s network.
Likewise it now is completely unpractical to use it as backup means for
bigger partitions (e.g. like images on DVDs). For a pure system backup
filesystem-aware images like partimage, g4u, Norton Ghost or similar are
better due to their reduced image size.
In contrast to these DD still is superiour when it comes to creating a
forensic image. Or when the ghoster doesn't recognize your file system,
or similar. So here's how to do with on-board tools.
Depending on the speed of your PC you should run no compression for
(really) low performance CPUs (< 600MHz), compress for medium sized and
gzip for CPUs > 2GHz.. Alternatively you could leave out
the compression and store uncompressed images - if you have enough
hard disk space and a fast network, that is. One problem is that GZIP
won't do more than 2GB image size, so beware...
Requirements:
- Two or more identical PCs that are supported by the
- Boot media (floppy or CD) that can handle the hardware as well
as the wanted filesystems, my recommendations: Knoppix CD in text mode
(http://www.knoppix.org/)
and TRBT floppy (http://www.toms.net/rb/).
Make sure you're logged in as ROOT user.
- Optonal an "image server" for central storage of the (different)
image files - thus need for enough disk space.
- Network infrastructure for the PCs - a simple crosslink cable
often is enough - is using an image server, a switched
environment is preferrable.
- The netcat program - usually it is called "netcat", but some other
distributions call it "nc"
- If your harddisc is broken, use "dd_rescue"
(http://www.garloff.de/kurt/linux/ddrescue/
which will skip read errors. This way you can (try to) rescue data
from a broken disc when simple TARing won't do anymore.
Create the image:
- Install and configure the master PC (i.e. the PC to be imaged)
- Cleanup the disk space for each partition used for better
compression, e.g. using:
dd if=/dev/zero of=empty.tmp bs=1024 count=FREEBYTESCOUNT
rm empty.tmp
- Start command on the image server to accept the image on an
arbitrary TCP port (usually above 1024):
netcat-v -w 120 -p PORT -l < /dev/null > image.gz
- Within 120 seconds start sending the image from the master PC to
the image server:
dd if=/dev/hda bs=512 | gzip -c | netcat-v -w 60 SERVERIP PORT
Flatten the "virgin" PC and impress the image:
- WARNING! This will utterly destroy each and all data on the PC
involved!
- Boot with independent media and configure the network
- Prepare the image server to send the image:
cat image.gz | netcat-v -w 120 -p PORT -l
- Fetch image and impress it onto the PC's harddrive:
netcat-v -w 60 SERVERIP PORT < /dev/null | gzip -dc | dd of=/dev/hda bs=512
- Reboot and accept the complaining FSCK which will run and correct
without problems.
Copy PC On-the-Fly without using an image server
- WARNING! This will utterly destroy each and all data on the PC
involved!
- Boot client with independent media and configure the network
- prepare the client to accept the image and write it directly to
the disk:
netcat-v -w 120 -p PORT -l < /dev/null | gzip -dc | dd of=/dev/hda bs=512
- Send the image from the master:
dd if=/dev/hda bs=512 | gzip -c | netcat-v -w 60 SERVERIP PORT
- Reboot and accept the complaining FSCK which will run and correct
without problems.