Live migrating a virtual machine with libvirt without a shared storage

We received our new VM host today, so the first thing I wanted to try was live migration. I started with the virsh migrate –help command, then looked up the official documentation to find out what should I exactly do.

What command to run?

As of today, the official libvirt: Guest migration page is a bit outdated and has a lot of different transport modes and configuration available. To be honest, I do not understand the libvirt migration models, and I did not spend much time trying to understand it.

I want to migrate a VM without any interruption and without using any shared storage. So basically the new host will receive a running virtual machine that it never heard about, neither does it have the associated virtual disks. Apart from this, I want the persistent VM to remain persistent on the receiving host.

Continue reading “Live migrating a virtual machine with libvirt without a shared storage”

Adding a disk to the virtual machine on the fly

It is possible to add a disk to your virtual machine, and get it working without restarting the guest. You just have to rescan the PCI bus, to detect the new controller, with:

echo 1 > /sys/bus/pci/rescan

After the above command, the new controller should be visible and the guest should see the new disk(s). PCI hotplug is also available, but you have to load some kernel modules to make it work.

I did not test it, but it should work if you load acpiphp and pci_hotplug (according to Daniel’s post).

Online resizing an ext4 root file system

Resizing online is possible and it is even better with the new 3.3 Linux kernel

You can extend an ext4 file system – even if it is your current root and your OS is running. On the other hand, online shrinking is only supported from version 3.3 of the Linux kernel.

In this example, I will show you how I extended a real life, live ~5 GB virtual disk (with an ext4 file system) to 10 GB.

Read more about the new 3.3 and 3.4 Linux kernel versions at http://www.ibm.com/developerworks/library/l-33linuxkernel/ (thanks Joro).

Continue reading “Online resizing an ext4 root file system”