|
| 1 | +:_newdoc-version: 2.18.5 |
| 2 | +:_template-generated: 2025-08-14 |
| 3 | +:_mod-docs-content-type: PROCEDURE |
| 4 | + |
| 5 | +[id="virt-generating-a-vm-memory-dump_{context}"] |
| 6 | += Generating a VM memory dump |
| 7 | + |
| 8 | +When a virtual machine (VM) terminates unexpectedly, you can use the `virtctl memory-dump` to generate a memory dump command to output a VM memory dump and save it on a persistent volume claim (PVC). Afterwards, you can analyze the memory dump to diagnose and troubleshoot issues on the VM. |
| 9 | + |
| 10 | +// You can specify an existing PVC or use the `--create-claim` flag to create a new PVC. |
| 11 | + |
| 12 | +.Prerequisites |
| 13 | + |
| 14 | +* The hot plug feature gate is enabled in the `HyperConverged` custom resource. To do so, run the following command: |
| 15 | ++ |
| 16 | +[source,terminal,subs="attributes+"] |
| 17 | +---- |
| 18 | +$ oc patch hyperconverged kubevirt-hyperconverged -n {CNVNamespace} \ |
| 19 | + --type json -p '[{"op": "add", "path": "/spec/featureGates", \ |
| 20 | + "value": "HotplugVolumes"}]' |
| 21 | +---- |
| 22 | + |
| 23 | +* Optional: You have an existing PVC on which you want to save the memory dump. |
| 24 | +** The PVC volume mode must be `FileSystem`. |
| 25 | +** The PVC must be large enough to contain the memory dump. |
| 26 | ++ |
| 27 | +The formula for calculating the PVC size is `(VMMemorySize + 100Mi) * FileSystemOverhead`, where `100Mi` is the memory dump overhead, and `FileSystemOverhead` is defined in the `HCO` object. |
| 28 | + |
| 29 | +.Procedure |
| 30 | + |
| 31 | +. Create a memory dump of the required VM: |
| 32 | + |
| 33 | +** If you have an existing PVC selected on which you want to save the memory dump: |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ virtctl memory-dump get <vm_name> --claim-name=<pvc_name> |
| 38 | +---- |
| 39 | + |
| 40 | +** If you want to create a new PVC for the memory dump: |
| 41 | ++ |
| 42 | +[source,terminal] |
| 43 | +---- |
| 44 | +$ virtctl memory-dump get <vm_name> --claim-name=<new_pvc_name> --create-claim |
| 45 | +---- |
| 46 | + |
| 47 | +. Download the memory dump: |
| 48 | ++ |
| 49 | +[source,terminal] |
| 50 | +---- |
| 51 | +$ virtctl memory-dump download <vm_name> --output=<output_file> |
| 52 | +---- |
| 53 | + |
| 54 | +. Attach the memory dump to a Red Hat Support case. |
| 55 | ++ |
| 56 | +Alternatively, you can inspect the memory dump, for example by using link:https://github.com/volatilityfoundation/volatility3[the volatility3 tool]. |
| 57 | + |
| 58 | +. Optional: Remove the memory dump: |
| 59 | ++ |
| 60 | +[source,terminal] |
| 61 | +---- |
| 62 | +$ virtctl memory-dump remove <vm_name> |
| 63 | +---- |
0 commit comments