Pause QEMU/KVM VM (save RAM and CPU state to disk) like vmware Player?
Solution 1
The virt-manager
window has a feature "shut down" -> "save".
Additional drivers are not required. I think the obvious bad thing happens with system time inside the guest. I don't know if there are guest drivers available to let the clock catch up.
Solution 2
To achieve the same thing as VMmware's "Suspend" in virsh
, do:
virsh managedsave <domain-name>
The machine can later be resumed with
virsh start <domain-name>
On my tested host (Ubuntu Server 14.04), the save file is stored at:
/var/lib/libvirt/qemu/save/<domain-name>.save
Solution 3
The Red Hat Virtualization Deployment and Administration Guide has a section on this, but if you don't have access then it wont be much help...
In a nutshell, what you are looking for is the virsh dompmsuspend
command and option. The GUI utilities for KVM are okay but leave a LOT of functionality out. The virsh
command can do anything you need it to, given the right options and parameters. I am not familiar with 'suspending' a KVM guest, so I can't really give you much guidance, but the documentation should have everything you need.
Related videos on Youtube
Ned64
Updated on September 18, 2022Comments
-
Ned64 over 1 year
Is it possible to save the state of a virtual machine under QEMU/KVM/libvirt (on x86-64) to disk like you can on vmware Player, that means:
- The RAM and CPU/system state is save to disk
- The OS is stopped from the outside (no suspend to disk within the VM)
- The VM can be continued after rebooting the host?
If it is possible, would it need special drivers within the VM? Which one for Linux and Windows 7 guests?
-
Admin about 7 years
virsh
knows the commandssuspend
,dompmsuspend
andmanagedsave
for different tasks (see access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/…) -
Admin about 7 yearsspecifically
managedsave
is the one which meets these requirements -
Admin over 5 yearsI am new to qemu, but doesn't savevm do what you want?
-
Ned64 about 7 yearsSo it has. Thanks very much, had not spotted it. For everyone who is interested, this needs space in
/home/$USER/.config/libvirt/qemu/save
which may be a link to a folder on a larger disk if needed. -
Ned64 about 7 yearsThanks for the reply! That's what @ridgy suggested (and @sourcejedi detailed in its comment). Used
virt-manager
for the moment but shall try this out in the beloved command line, as well. -
Ned64 over 4 yearsThanks, this is the command line equivalent of the accepted answer and useful as an addition.