Linux – LVM-snapshot based KVM VMs

kvm-virtualizationlinuxlvmsnapshot

As far as I know, LVM snapshots basically don't take any "real" space on hard drives.

I'm using KVM virtualization on my hosts and let's say I create an LVM volume for my Linux VM, then install it properly, shut it down and take LVM snapshot of it.

Basically i've just cloned it (LVM2 snapshots are r/w).

I feed it to KVM and that's it? Can I snapshot this volume N number times and get N number of VMs that take zero actual space on actual hard drive?

When cloned VMs start writing, they will be actually writing only diffs from "master" VM. This looks like an interesting idea to manage a lot of "template" VMs while saving huge amounts of disk space.

Or maybe I'm just inventing the bicycle. What do you think? Is this possible?

Best Answer

LVM snapshots currently suffer horrible performance when you try to create multiple snapshots of the same origin at once, and you must reserve space for each snapshot separately, so this is not a good idea. You would be much better off using qcow2 images instead of raw lvm volumes, as they do have good snapshot support, and you can set up a read only base image for multiple read/write images for different VMs to use as a shared starting point.

Related Topic