Linux Volume Manager and Kernel-Based Virtual Machines

Few months ago I started experimenting with Linux Volume Manager (LVM). Being encouraged by friends who where already using LVM and showing me how easy it could be to resize partitions, make new ones, etc.

My desktop needed reinstalling anyhow, so I figured why not try out LVM right away. Since I had no experience with LVM I let the (K)Ubuntu installer set up LVM for me. It made a /boot as the first partition with a ext2 filesystem. The rest of the disk was an LVM physical volume. This pv was added to the ‘star-destroyer-vg’ volume group. In this vg there where two logical volume created, a root lv and a swap lv.

Usually I have a separate partition for /home. So I went ahead and added it with lvcreate. Then mounted it to /mnt, copied the current contents of /home to /mnt. Removed the contents of /home and mounted the home lv to /home. Lastly I added the mount to fstab.

Then the moment of truth, reboot and see if everything works.

Rebooting…. Logging in…

mount|grep home-lv

Whoo there is output 😀

After a couple of days I tried a live-resize. I can’t recall what partition I resized at the time, but it is still an awesome feature to just say:

lvresize -L+5G <path-to-lv> && resize2fs <path-to-lv>

And your partition is 5Gb larger, without unmounting or booting in to live-disks :D.

Then I started to look at Kernel-based Virtual Machines. At the time I used Virtual Box for my VM needs. Phoronix compared KVM to Virtual Box, Xen and Bare Metal. It was concluded that KVM was not much below Bare Metal in terms of performance. Installed lib-virt and virt-manager on my desktop. Since I’m part of the Kubuntu Testers Team the first install I did was a Trusty install.

Lovely thing to me was that I could just hand the virtual machine a logical volume as disk. Also the performance of these virtual machines was quite fine. They seemed to be faster than the Virtual Box VMs, though that might just be me wanting KVM to be faster.

I liked KVM so much I installed in onto my server. The host that is serving you this page is actually a virtual machine.

Olivier van der Toorn is a security researcher and Linux enthousiast.