I have a KVM box running some critical VMs which perform software builds. The server runs SSD drives. I have an older version of KVM which has limited snapshot capability, and I have decided to use LVM snapshots to save the VM states after each new release (so we can revert to a certain release if we need to patch). The PVs are full, so I need to add a disk to the volume group for the snapshots to live on. Is there any harm to adding a regular USB drive to the volume group that the VMs live on, just for a storage place for LVM snapshots? Will I lose the SSD speed?
several points here
- LVM snapshots do not form a chain, they do not use the COW algorithm, you can only have one really. If you need a snapshot chain to be able to roll back anywhere, you need to use qcow2 snapshots.
- Having said that, running a production VM off of a chain of snapshots is not recommended in production, the performance hit can become quite significant after a while, not to mention the loss of space. This is not just a KVM thing, any VCP instructor will tell you the same thing.
- Mixing different types of storage under one VG is not best practice either. I've seen LVM go down in flames when two different LUNs from two different raid arrays were mixed in a striped volume, serialized will probably be more stable, but why risk your VM so?
I would do this in a different way:
- Use LVM snapshots to back a VM upwhenever I need to
- save the backups on the USB disk, separate from the runtime LVM data
- In case of a rollback, replace the LV on SSD with the one from backup.
I know this will mean keeping full backups in place, but with proper planning, you will not deviate from your current SSD performance, and will not lose the current system stability, be able to roll back to a reasonable amount of PITs and stay within best practice boundaries