[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How do I clone Computer A from Computer B?

On Mar 3, 2011, at 12:42 PM, Jason Hsu wrote:

> Computer A is running minimal Debian with a firewall and servers, including SSH.
> I can use Computer B to ssh my way into Computer A.  How do I use Computer B to clone Computer A?  So far, I've only been able to clone Computer A by booting up a live CD on Computer A and running PartImage.

I'm not clear if you want to clone A to B, or if you're planning on using A as an image for later installs.  In other words, by cloning A, it could be your intent to take the cloned image and install it in other computers along the way.  By "use Computer B to clone Computer A," it sounds to me like you want to create a cloned image of Computer A that can be stored on Computer B.  That's what leads me to wonder if the intent is to create an image of A, and it would seem a most likely use of that image would be to use to create new systems easily and quickly.

If that is your purpose, I just went through that in creating an image for embedded systems (specifically a Soekris Net5501).

There's one issue nobody's mentioned here: now Debian (and a lot of distros) keeps track of drives and partitions with UUIDs since people are using portable RAM drives now.  This effects GRUB2 and /etc/fstab.  So if you clone A to an image or to B, be sure to be aware of the issues with UUIDs.  This can also create a problem with MAC addresses, too.

When using a cloned image moved from one set of hardware to another, I had to update /boot/grub/grub.cfg for the first boot, but also edit /etc/default/grub and make sure, after that first boot, that I ran update-grub and regenerated /boot/grub/grub.cfg (it's also possible to stick the UUID in /boot/grub/grub.cfg if you have a cloned image where you can edit the files).

The other problem that is easy to run into if you are, by chance, cloning the image to a computer without a keyboard or monitor, is that unless it has an assigned IP address, you won't know where it is on the LAN.  I solved this by writing a simple two-part program that makes it easy to find the new computers that use the cloned image I'm using.

I have an image I generated for use on the embedded system I mentioned and it has a Perl script that makes the needed modifications to get the image working on other hardware.  It also had the Perl scripts I used to make that system easily locatable on an LAN at http://halblog.com/SqueezeOnSoekris.html.  The Perl script that handles updating the image is pretty easy and if you look through it, you'll see all the changes it makes to the cloned image to make it easy to install on a new system without duplicating things like the host name.

While this covers more than what you asked, I hope it helps since these are issues that you'll run into these days when you run a cloned system on hardware other than that which the source of the clone runs on.


Reply to: