Tag Archives: virt-clone

New tool: virt-sysprep

New in libguestfs 1.13.19 is a tool called virt-sysprep which makes it easier to clone virtual machines.

The new tool isn’t a complete clone tool, but you can easily combine it with other tools like dd, the old virt-clone, virt-resize and virt-sparsify to clone virtual machines.

Advertisements

6 Comments

Filed under Uncategorized

Article about cloning guests with libguestfs

Librarian probably knows more about cloning guests using libguestfs than anyone. He’s written an article about it (Russian — Google translated version).

Leave a comment

Filed under Uncategorized

Virt tools survey: What to do about virt-clone?

Do you clone virtual machines? Do you use virt-clone or some other tool, or have you written a homebrew solution?

Read our virt tools survey: what to do about virt-clone. You can reply on the virt-tools mailing list or just follow up in comments here.

2 Comments

Filed under Uncategorized

Tip: my procedure for cloning a Fedora VM

Update: New in libguestfs ≥ 1.13.19 is a tool to “sysprep” VMs. See the virt-sysprep manual page

To clone a Fedora VM by hand you need a mixture of host (ie. LVM, libvirt) and guest (ie. libguestfs) operations. This is how I currently do it by hand:

Create new storage and copy the old VM. Because I’m using logical volumes, the size of the new LV must be exactly the same as the size of the old LV:

# lvcreate -L 10G -n FNew vg_host
# dd if=/dev/vg_host/F14 of=/dev/vg_host/FNew bs=1M

Copy and modify the libvirt XML:

# virsh dumpxml F14 > /tmp/fnew.xml
# emacs /tmp/fnew.xml

You need to change the following 4 fields in the XML: <name>, <uuid>, <source dev='/dev/vg_host/...'> and <mac address='...'>. For the UUID and MAC address, just randomly change the last few digits.

Define the new guest, but don’t boot it just yet:

# virsh define /tmp/fnew.xml
Domain FNew defined from /tmp/fnew.xml

There are two files you need to edit inside the guest:

# guestfish -i -d FNew

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for a list of commands
      'man' to read the manual
      'quit' to quit the shell

Operating system: Fedora release 14 (Laughlin)
/dev/mapper/vg_f13x64-lv_root mounted on /
/dev/vda1 mounted on /boot

><fs> edit /etc/sysconfig/network
(change the hostname)
><fs> edit /etc/udev/rules.d/70-persistent-net.rules
(change the MAC address to the same as the one in the libvirt XML file)
><fs> exit

Now you can go ahead and boot the new, cloned guest.

On the virt tools roadmap is a plan to refresh the old “virt-clone” tool to do all this properly and automatically.

9 Comments

Filed under Uncategorized