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?

  • Could someone please tag this "linux-kvm"?
    – Martin M.
    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"
    – Martin M.
    Jun 12 '09 at 16:23

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.

  • 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
  • 1
    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 Dec 7 '10 at 0:00

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

  • 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. Dec 7 '10 at 0:01

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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