Dump qemu virtsh VM RAM to File

  1. List running VMs
1
sudo virsh list
1
2
3
4
5
[ecomaikgolf@laptop ~/]$ sudo virsh list
[sudo] password for ecomaikgolf: 
 Id   Name            State
-------------------------------
 1    fedora-kernel   running
  1. Send qemu-monitor command
1
sudo virsh qemu-monitor-command VMNAME --hmp "dump-guest-memory /var/lib/libvirt/qemu/dump/test"
1
sudo virsh qemu-monitor-command fedora-kernel --hmp "dump-guest-memory /var/lib/libvirt/qemu/dump/test"
1
2
[ecomaikgolf@laptop ~/]$ sudo du -h /var/lib/libvirt/qemu/dump/test
2.1G	/var/lib/libvirt/qemu/dump/test

Note: Take note about filesystem permissions + SELinux. Dump the RAM to the libvirt path I’ve shown if you get permission errors.