Using virsh dump to create dumps on KVM hosts
The virsh dump command writes KVM guest dumps to a file in the KVM host file system.
Before you begin
About this task
The virsh dump command is installed with the libvirt package on the KVM host. Apart from setting aside a host directory with sufficient storage space to hold the dumps, no special preparation is needed.
You can use virsh dump to create dumps of both running or crashed KVM guests. By default, virsh dump pauses a running guest during the dump process, but the guest continues running when the dump is complete.
For more information about KVM guests, KVM virtual servers, and virsh commands, see KVM Virtual Server Management, SC34-2752.
Procedure
On the KVM host, issue a virsh dump command with
the --memory-only option to create a dump.
# virsh dump --memory-only [<mode>] <virtual_server> <dump_file>
where- --memory-only
- writes the dump file in a valid
elf
format as required by the crash tool. - <mode>
- Optional: specifies one of the following dump modes.
- --crash
- halts the KVM guest with a crashed state before starting the dump process.
- --reset
- resets the virtual server when the dump process is complete.
- --live
- does not pause the guest during the dump process. This option can result in an inconsistent dump.
- <virtual_server>
- specifies the name of the virtual server on which the KVM guest runs.
- <dump_file>
- specifies the file to which the dump is written. If a file name without a fully qualified path is specified, the dump file is written to the current working directory from which the visrh dump command is issued.
The following example creates a dump of a Linux®
instance on a virtual server
vserv3
to a host file
/dumps/vser3.dump1.elf.# virsh dump vserv3 /dumps/vser3.dump1.elf --memory-only