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 (thanks Joro).

Continue reading “Online resizing an ext4 root file system”