Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

In theory this should be fine but how are you going to ensure the VM data doesn't end up on the USB disk?

share|improve this answer
    
Only snapshot data will end up there, I am never mounting it, just adding it to the VG. –  user160910 Aug 30 '13 at 14:34
    
Good point, well made :) –  Chopper3 Aug 30 '13 at 14:47

several points here

  1. 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.
  2. 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.
  3. 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:

  1. Use LVM snapshots to back a VM upwhenever I need to
  2. save the backups on the USB disk, separate from the runtime LVM data
  3. 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

share|improve this answer
    
I thought LVM snapshots do use COW. Also, I think that when you create a snapshot, it is essentially like creating a volume in the free space of the volume group, if my volume group is full and then I extend it with this USB drive, and new volume in the group would have to be created there, including snapshots, however if I don't mount the volumes/snapshots, then I was thinking the slower disk speeds would be moot and it would just be a storage for the not mounted snapshot LVs. –  user160910 Aug 31 '13 at 21:12
    
well, if you're very careful and you monitor your LVM down to the block offsets, you could pull it off, but this construct would be flimsy at best. Those snaps aren't COW though –  dyasny Sep 1 '13 at 0:23
    
Do qcow2 snapshots affect performance as more are created like LVM snapshots do? Is there any way to show all of the internal snapshots on a qcow2 image? It seems qemu-img info shows only one, when it does not account for the size of the file being so large. I assume there are more snaps but don't know how to see them. –  user160910 Sep 6 '13 at 20:20
    
Yes, every snapshot has an effect on performance. It is not recommended to use them on loaded VMs in production (and I'm not talking only about qcow2 - every virtualization system has this recommendation). To see all the snapshots, I usually write a simple script which recursively checks the information for every image and builds the snapshot chain. –  dyasny Sep 6 '13 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.