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've recently begun using KVM for my development/test environment on a Linux host system with 8G memory. Prior, I was using VMware Fusion for my virtual environment, but my Macbook only has 2G memory. I tried VMware Server and ESX on the host instead of KVM, but the webUI doesn't run on Mac OSX's Firefox, and we're going to be doing more with KVM anyway.

The main feature of VMware I miss is robust snapshot/rollback, but I'm missing this in KVM. I understand the snapshot command, but it shuts down the guest OS when complete, and then copying the disk image to preserve its state is cumbersome.

Is this really the best way to manage snapshots on KVM?

share|improve this question
    
Could someone please tag this "linux-kvm"? –  Server Horror Jun 9 '09 at 21:10
1  
Your wish is my command, Server Horror! –  jtimberman Jun 9 '09 at 22:44
    
Heh, thanks no "sudo go make me sandwich" –  Server Horror Jun 12 '09 at 16:23
add comment

3 Answers 3

up vote 12 down vote accepted

KVM has a much better snapshot capability than what's managed by libvirt; but it depends on qcow2 images. if you use them, just do a savevm <name> on the command console (blocked by libvirt) it won't create a new file, it's a snapshot inside the qcow2 file.

test it first, because some KVM versions have it broken.

share|improve this answer
    
Yeah, no dice. $ sudo kvm app3.img -monitor stdio -k en-us (qemu) savevm Device ide0-hd0 does not support VM state snapshots –  jtimberman Jun 9 '09 at 23:02
    
Will have to convert my images to qcow, or rebuild them entirely, but thanks for this. –  jtimberman Jun 12 '09 at 22:06
    
qemu-img is the answer, if savevm is restricted. Still requires qcow2 or other COW image –  dyasny Nov 12 '10 at 11:45
2  
libvirt now has snapshot-create, snapshot-list, and snapshot-revert commands –  Arthur Ulfeldt Dec 7 '10 at 0:00
add comment

You can combine KVM hosts with LVM technology. If you install all your machines on a separated LV, using an Logical Volume for each machine, you can create hot backups / snapshots using LVM features. Is like the solaris ZFS snapshot, try it ;)

share|improve this answer
    
Wesley, that's not quite the same thing. VMWare snapshotting stores the machine's memory and CPU state so when you rollback it's like the entire VM has just jumped back in time to the point where you took the snapshot. With your method, when you boot from an LVM snapshot, you're doing the equivalent of bringing the virtual machine back from a crash. Hope you didn't have anything important in memory that hadn't been committed to the disk - and that you didn't have any filesystems that are susceptible to severe damage if that happens (eg. XFS). –  user58954 Nov 2 '10 at 11:56
    
That would only give you filesystem snapshots and not the state of the running system. –  Arthur Ulfeldt Dec 7 '10 at 0:01
add comment

Seems the only way to do it "properly" is to patch QEMU when you say no for qcowN formats.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.