Oskar Stolc's Howto Collection

Articles in the KVM category

KVM - Online Disk Resize

This HOWTO assumes a KVM guest called 'vm' backed by an LVM volume called 'vm-data'.

On Hypervisor

# lvs
  vm-data      VG -wi-ao--  100.00g
# lvresize -L 200G /dev/VG/vm-data
  Extending logical volume vm-data to 200.00 GiB
  Logical volume vm-data successfully resized
# lvs
  vm-data      VG -wi-ao--  200.00g
# virsh blockresize …

KVM - Guest Creation and Automated Installation

I wrote a script for creating CentOS, Fedora, Ubuntu, and Debian KVM guests. The guest OSes are installed automatically using kickstart or preseed.

  • UPDATE - 2013-05-06 - Added Ubuntu 12.04
  • UPDATE - 2013-08-08 - Added Debian 7.1
  • UPDATE - 2013-08-16 - Added Fedora 19, removed Fedora 18

Copy the create-vm.sh scrip to hypervisor …

KVM - Clone Guests from Template Image

To clone a KVM VM you need

  • a definition file (RAM size, number of CPUs, etc...)
  • and a template disk image (with installed OS)

Creating Definition File And Template Image

The definition file is just a libvirt xml file. The template image is just a VM disk image. This is …

KVM - Move Guest to Another Host

Say you got a new KVM hypervisor (kvm02) and want to move a VM to it from an older host (kvm01). You are OK to shut the VM down while the VM is being transfered (this is not a live migration).

This is what you do:

On the Old Host …

KVM Hypervisor on CentOS 6

In this blog we will learn how to set up a KVM hypervisor.

The linux kernel itself is the hypervisor. All we need is to install some user space tools for managing VMs.

# yum install kvm libvirt python-virtinst qemu-kvm bridge-utils

Then we need to start the libvirt daemon

# chkconfig libvirtd …