Free P2V and V2P with Open Source Tools
ByHow to duplicate a complete PC via network
Imagine you get the task to quickly set up a number of identical workstations. Unfortunately either the available removable media (e.g. CD) is too small, or the imaging tool you use insists on not recognizing your favourite file system type (esp. Ext3, XFS, JFS, Reiser), or the duplication won’t work with your bizarre multiboot configuration. Here’s how to do with on-board tools.
Depending on the speed of your PC you should run no compression for low performance CPUs, compress for medium sized and gzip for CPUs > 2MHz.. 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.
View Comments Comments
March 14th, 2009 at 10:12 pm
This procedure is a bit risky, are there other ways on how to How to duplicate a complete PC via network?
March 15th, 2009 at 5:12 am
This procedure is a bit risky, are there other ways on how to How to duplicate a complete PC via network?
March 15th, 2009 at 5:09 am
Actually the procedure is pretty safe. The source machine is not changed at all during the dd imaging, so the rollback is to reboot the source machine to bring it back online. We had one client that had nearly 100 SUSE Linux 9 machines they P2V'd this way.
If you are using VMware, they have VMware Converter that is free and included with the the VI3.5 products. Citrix has XenConvert that is free with XenServer that is also free.
For the most flexibility and power, there are third-party tools. I've used Platespin's PowerConvert many times and depending on your downtime window and SLA requirements of the source server, they can make it to where you can meet nearly impossible downtime timeframes. We P2V'd some servers between two geographically separated datacenters with PowerConvert's block level P2V with not much more than a reboot of the server downtime.
March 15th, 2009 at 12:09 pm
Actually the procedure is pretty safe. The source machine is not changed at all during the dd imaging, so the rollback is to reboot the source machine to bring it back online. We had one client that had nearly 100 SUSE Linux 9 machines they P2V’d this way. rnrnIf you are using VMware, they have VMware Converter that is free and included with the the VI3.5 products. Citrix has XenConvert that is free with XenServer that is also free. rnrnFor the most flexibility and power, there are third-party tools. I’ve used Platespin’s PowerConvert many times and depending on your downtime window and SLA requirements of the source server, they can make it to where you can meet nearly impossible downtime timeframes. We P2V’d some servers between two geographically separated datacenters with PowerConvert’s block level P2V with not much more than a reboot of the server downtime.