I have a Lenovo ThinkPad T430 running Red Hat Enterprise Linux 6.7, kernel 2.6.32 and QEMU-KVM 0.12.1 (per corporate policy I am not allowed to run a more cutting-edge distribution or any more recent packages). For a training workshop I have to use a QEMU-KVM VM with a qcow2 drive image started directly via the QEMU executable, without virt-manager, and every now and then I need to save my VM's state to disk. However, issuing savevm <snapshot name> on my VM's monitor console is extremely slow -- saving a snapshot with merely 2 GB of RAM takes easily about 10 minutes or more. I already made sure to check that I'm using cache=writeback on my virtual HD.

I've read online that the workaround is to use cache=unsafe, but I'm worried about having my disk image corrupt should my QEMU executable crash or my laptop lose battery power.

Is there any way to make faster QEMU VM snapshots outside of moving them to a faster drive?

  • As your host's bottleneck is probably the spinning harddisk, the RAM and swapping is most likely an issue, you can't really speed it up unless you add slightly more RAM to prevent swapping to disk and also use an SSD for both target and destination of the snapshot. – doktor5000 Jul 27 '16 at 14:51
  • Yeah, reading online it seems like QEMU's behavior of handling virtual HD writes as transactions with writeback and writethrough also applies to snapshot making. I hazard that you could probably replicate libvirt's fast snapshots with some hack like dumping the memory to a separate file and making a drive snapshot or something. – RAKK Jul 27 '16 at 16:26
  • Would corporate policy allow you to run your virtual machines on ZFS file systems? This is what I do on my Lenovo ThinkPad W540. Of course taking snapshots and rolling back are effectively instantaneous. I suspect you could do the same with BTRFS, but I don't know enough about that FS to give any advice there. – airhuff Jan 18 '17 at 22:35
  • My corporate distro has the FUSE version of ZFS. Is that good enough? – RAKK Jan 19 '17 at 22:51

Your Answer

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

Browse other questions tagged or ask your own question.