Skip to content

Convert libvirt-QEMU-save (LQS) files to raw memory files

License

Notifications You must be signed in to change notification settings

juergh/lqs2mem.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lqs2mem.py
----------

A tool for converting the memory content of a Libvirt-QEMU-save or QEMU-savevm
file to a raw physical memory file.

Note that lqs2mem.py is a Python-rewrite of the C-tool lqs2mem at
https://github.com/juergh/lqs2mem.

Acquiring memory from a Libvirt/KVM virtual machine
---------------------------------------------------

Use the virsh 'dump' command to save the virtual machine's state to a file on
disk without stopping the virtual machine, or the virsh 'save' command to save
the virtual machine's state to a file on disk and stop the virtual machine. A
virtual machine stopped with the 'save' command can later be restarted with the
'restore' command.

The output of the 'dump' command is a file in QEMU-savevm format. The output
of the 'save' command is a file in Libvirt-QEMU-save (LQS) format. An LQS file
contains a header with the virtual machine's Libvirt configuration, followed by
QEMU-savevm format data. The QEMU-savevm format captures the state of a
virtual machine in a series of sections, each section representing the state of
a device. For example, there is CPU state, RAM state, block device state, and
more.

Converting virtual machine dumps to raw memory files
----------------------------------------------------

The lqs2mem.py tool converts LQS or QEMU-savevm files into raw physical memory
images.  It reads data from the RAM sections of the input file and writes it to
a file in which each byte corresponds to a byte of the virtual machine's
physical memory. That is, reading from position 'x' of a raw physical memory
image is equivalent to reading from physical address 'x' of memory.

A typical LQS or QEMU-savevm file contains different memory sections. The
lqs2mem.py tool can be used to list the available sections and then convert the
specified section to a raw memory file.

Examples
--------

List the available sections:

$ lqs2mem.py instance-00000d93.save
section = pc.ram                           size = 512 [MB]  536870912 [Bytes]
section = pc.bios                          size = 128 [KB]     131072 [Bytes]
section = pc.rom                           size = 128 [KB]     131072 [Bytes]
section = vga.vram                         size =  16 [MB]   16777216 [Bytes]
section = 0000:00:02.0/cirrus_vga.rom      size =  64 [KB]      65536 [Bytes]
section = 0000:00:03.0/virtio-net-pci.rom  size =  32 [KB]      32768 [Bytes]

Write the virtual machine's main memory (pc.ram section) to a raw memory
file:

$ lqs2mem.py -s pc.ram instance-00000d93.save instance-00000d93.ram
section = pc.ram                           size = 512 [MB]  536870912 [Bytes]
section = pc.bios                          size = 128 [KB]     131072 [Bytes]
section = pc.rom                           size = 128 [KB]     131072 [Bytes]
section = vga.vram                         size =  16 [MB]   16777216 [Bytes]
section = 0000:00:02.0/cirrus_vga.rom      size =  64 [KB]      65536 [Bytes]
section = 0000:00:03.0/virtio-net-pci.rom  size =  32 [KB]      32768 [Bytes]
Wrote 536870912 bytes from section 'pc.ram' to file instance-00000d93.ram

About

Convert libvirt-QEMU-save (LQS) files to raw memory files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published