13

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?

3
  • Could someone please tag this "linux-kvm"? Jun 9, 2009 at 21:10
  • 1
    Your wish is my command, Server Horror!
    – jtimberman
    Jun 9, 2009 at 22:44
  • Heh, thanks no "sudo go make me sandwich" Jun 12, 2009 at 16:23

3 Answers 3

16

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.

4
  • 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, 2009 at 23:02
  • Will have to convert my images to qcow, or rebuild them entirely, but thanks for this.
    – jtimberman
    Jun 12, 2009 at 22:06
  • 1
    qemu-img is the answer, if savevm is restricted. Still requires qcow2 or other COW image
    – dyasny
    Nov 12, 2010 at 11:45
  • 2
    libvirt now has snapshot-create, snapshot-list, and snapshot-revert commands Dec 7, 2010 at 0:00
5

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 ;)

2
  • 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, 2010 at 11:56
  • That would only give you filesystem snapshots and not the state of the running system. Dec 7, 2010 at 0:01
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .