Utilizing lvm thin provisioned snapshots
To fully utilize the few bits of space which is provided by my SSD, I always take the following approach:
- Create an “as large as possible” LVM volume group to hold all my data.
- Create a thin_pool within the volume group for my virtual machines.
- Create one “base VM” which contains just a bare installation of my preferred OS (inside the thinpool).
- Now for each VM I need for my labs I create a snapshot from the base VM
lvcreate --snapshot --name thin_snapshot vg/thin_base
- Now to ensure that I can actually utilize the newly created snapshot I have to activate it first.
LVM (thin) snapshot are “by default” created in inactivated mode, but it also has the “activation skip flag”. This flag prevents the system from activing the partition with the usual commands. To active the partition use:
lvchange -ay -K vg/thin_snapshot
To remove the skip flag completely add:
lvchange -kn vg/thin_snapshot
Finally the newly added thinly provisioned snapshot is available for usage by my virtualisation tool.