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?

jtimberman
  • 7,511
  • 2
  • 33
  • 42

3 Answers3

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.

Javier
  • 9,078
  • 2
  • 23
  • 24
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 ;)

  • That would only give you filesystem snapshots and not the state of the running system. – Arthur Ulfeldt Dec 07 '10 at 00:01
  • 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). –  Nov 02 '10 at 11:56
1

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