Xen Workflow – Copy VMs

Creating VMs from scratch in XenServer is a bit of a hassle, but that’s OK because it’s not a frequent task. Typically you’d create one (or a few) base templates, and then make copies whenever you want to spin up a new disk. This process is very simple and straightforward in XenServer, and easily automated.

Using the method described in my last post, create a basic install of your chosen linux variety (the same process works for Windows, but there is an extra step). Once you have the base system installed shut it down. It’s now ready to be cloned.

And then, there were two
There are two ways to make a copy of a VM. You can conserve disk space (and make cloning super fast) by using the Copy-on-Write strategy (“Fast clone”), but there are some performance issues around chaining disk images, so I prefer full copies. At the command line, the command is: xe vm-copy new-name-label=ImANewVM vm=MyCentOSBase. This command will take several seconds, but when it’s done you’ll have a copy of the VM ready to go.

Doing a copy via XenAPI is easy, and (using xencap, with some user-prompting), it looks like this:

Published by

Patrick Schless

I'm a (mostly) ruby/rails developer, living in Chicago. I work at Braintree, and I have lots of side-projects.

Leave a Reply

Your email address will not be published. Required fields are marked *