Clone KVM-based Virtual Machines on Redhat / CentOS Linux

Prerequisite: Operating System and Software Versions

  • Operating System: – Redhat 7.3
  • Software: – libvirtd (libvirt) 2.0.0

Obtain Source Virtual Machine’s information

Before we begin cloning any virtual machine we first need to obtain some basic information about it. The absolute minimum information required about the source virtual machine we are about to clone would be its name and number of disk in use. To get virtual machines name run:

# virsh list
Id Name State
----------------------------------------------------
1 server1.local running

Next, we may would like to know the number of disk our source virtual machines is using as well as its location. The information about disks location is optional as it only provides us with a hint on where to store new clone disk files for the sake of consistency: # virsh dumpxml server1.local | grep "source file"
<source file='/var/lib/libvirt/images/server1.local.qcow2'/>
<source file='/var/lib/libvirt/images/server1.local-1.qcow2'/>
<source file='/var/lib/libvirt/images/server1.local-2.qcow2'/>

From the above output we can see that our original virtual machine has three disks stored in location /var/lib/libvirt/images/.

Read more

Share

Install Qemu Guest Agent on Proxmox

The qemu-guest-agent is a helper daemon, which is installed in the guest. It is used to exchange information between the host and guest, and to execute command in the guest.

In Proxmox VE, the qemu-guest-agent is used for mainly two things:

  • To properly shutdown the guest, instead of relying on ACPI commands or windows policies
  • To freeze the guest file system when making a backup (on windows, use the volume shadow copy service VSS).

Installation Host
You have to enable the guest-agent per VM, either set it in the GUI to “Yes” under options (see screenshot):

or via CLI:

qm set VMID --agent 1

Guest Linux
On Linux you have to simply install the qemu-guest-agent, please refer to the documentation of your system.

We show here the commands for Debian/Ubuntu and Redhat based systems:

Read more

Share

Converting OVA for use with KVM / QCOW2

The OVA file is nothing more than a TAR archive, containing the .OVF and .VMDK files. Easy!

Using Evergreen ILS for example:

~ $ file Evergreen_trunk_Squeeze.ova

Evergreen_trunk_Squeeze.ova: POSIX tar archive (GNU). I’ts possible to use the tar command to list the contents

~ $ tar -tf Evergreen_trunk_Squeeze.ova 
Evergreen_trunk_Squeeze.ovf
Evergreen_trunk_Squeeze-disk1.vmdk

Simply extract those things…

~ $ tar -xvf Evergreen_trunk_Squeeze.ova
Evergreen_trunk_Squeeze.ovf
Evergreen_trunk_Squeeze-disk1.vmdk

Read more

Share

Convert .ova and import it on Proxmox KVM virtualization

Let’s start uploading the exported ova file to the proxmox server. Extract the OVA file:

tar -xvf *.ova

This should output a couple of files from the OVA container, it should include an OVF file, which is the VM Defenition file, and a VMDK file, which is the actual hard disk image. Again, this may take a while.

Convert the vmdk to a Proxmox compatible qcow2 file:

qemu-img convert -f vmdk myvirtual-disk1.vmdk  -O qcow2 qcowdisk.qcow2

We now need to get the image into a VM with some hardware so that we can begin to use it. This is where things get tricky – the OVF file is not compatible with Proxmox and needs to be manually understood. The principle here is we are going to use the Proxmox web GUI to create a VM and replace the empty disk image which is created with our recently converted qcow2 image.

You can use vi to open the OVF file and understand some of the basic settings which are required for the VM. Open the OVF file and look for the following XML tags:

  • OperatingSystemSection
  • VirtualHardwareSection
  • Network
  • StorageControllers

Read more

Share

KVM Network Bridge configuration

 

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

 

# The loopback network interface

auto lo br1 eth1 br0 eth0

iface lo inet loopback

Read more

Share