The QEMU monitor is used to give complex commands to the QEMU emulator. You can use it to:
- Remove or insert removable media images (such as CD-ROM or floppies).
- Freeze/unfreeze the Virtual Machine (VM) and save or restore its state from a disk file.
- Inspect the VM state without an external debugger.
The following commands are available:
- Show the help for all commands or just for command cmd.
- Commit changes to the disk images (if -snapshot is used) or backing files. If the backing file is smaller than the snapshot, then the backing file will be resized to be the same size as the snapshot. If the snapshot is smaller than the backing file, the backing file will not be truncated. If you want the backing file to match the size of the smaller snapshot, you can safely truncate it yourself once the commit operation successfully completes.
- Quit the emulator.
- This command makes QEMU exit the preconfig state and proceed with VM initialization using configuration data provided on the command line and via the QMP monitor during the preconfig state. The command is only available during the preconfig state (i.e. when the –preconfig command line option was in use).
- Resize a block image while a guest is running. Usually requires guest action to see the updated size. Resize to a lower size is supported, but should be used with extreme caution. Note that this command only resizes image files, it can not resize block devices like LVM volumes.
- Copy data from a backing file into a block device.
- Set maximum speed for a background block operation.
- Stop an active background block operation (streaming, mirroring).
- Manually trigger completion of an active background block operation. For mirroring, this will switch the device to the destination path.
- Pause an active block streaming operation.
- Resume a paused block streaming operation.
- Eject a removable medium (use -f to force it).
- Remove host block device. The result is that guest generated IO is no longer submitted against the host device underlying the disk. Once a drive has been deleted, the QEMU Block layer returns -EIO which results in IO errors in the guest for applications that are reading/writing to the device. These errors are always reported to the guest, regardless of the drive’s error actions (drive options rerror, werror).
Change the configuration of a device.
changediskdevice filename [format [read-only-mode]]
Change the medium for a removable disk device to point to filename. eg:
(qemu) change ide1-cd0 /path/to/some.iso
format is optional.
read-only-mode may be used to change the read-only status of the device. It accepts the following values:
- Retains the current status; this is the default.
- Makes the device read-only.
- Makes the device writable.
change vnc password[password]
Change the password associated with the VNC server. If the new password is not supplied, the monitor will prompt for it to be entered. VNC passwords are only significant up to 8 letters. eg:
(qemu) change vnc password Password: ********
- Save screen into PPM image filename.
- Output logs to filename.
- changes status of a trace event
- Open, close, or flush the trace file. If no argument is given, the status of the trace file is displayed.
- Activate logging of the specified items.
Create a snapshot of the whole virtual machine. If tag is provided, it is used as human readable identifier. If there is already a snapshot with the same tag, it is replaced. More info at VM snapshots.
Since 4.0, savevm stopped allowing the snapshot id to be set, accepting only tag as parameter.
Set the whole virtual machine to the snapshot identified by the tag tag.
Since 4.0, loadvm stopped accepting snapshot id as parameter.
Delete the snapshot identified by tag.
Since 4.0, delvm stopped deleting snapshots by snapshot id, accepting only tag as parameter.
- Run the emulation in single step mode. If called with option off, the emulation returns to normal mode.
- Stop emulation.
- Resume emulation.
- Wakeup guest from suspend.
- Start gdbserver session (default port=1234)
- Virtual memory dump starting at addr.
xp /fmt addr
Physical memory dump starting at addr.
fmt is a format which tells the command how to format the data. Its syntax is:
- is the number of items to be dumped.
- can be x (hex), d (signed decimal), u (unsigned decimal), o (octal), c (char) or i (asm instruction).
- can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
wcan be specified with the
iformat to respectively select 16 or 32 bit code instruction size.
Dump 10 instructions at the current instruction pointer:
(qemu) x/10i $eip 0x90107063: ret 0x90107064: sti 0x90107065: lea 0x0(%esi,1),%esi 0x90107069: lea 0x0(%edi,1),%edi 0x90107070: ret 0x90107071: jmp 0x90107080 0x90107073: nop 0x90107074: nop 0x90107075: nop 0x90107076: nop
Dump 80 16 bit values at the start of the video memory:
(qemu) xp/80hx 0xb8000 0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42 0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41 0x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72 0x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73 0x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20 0x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720 0x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
- Print the host virtual address at which the guest’s physical address addr is mapped.
- Print the host physical address at which the guest’s physical address addr is mapped.
- Print the guest physical address at which the guest’s virtual address addr is mapped based on the mapping for the current CPU.
- Print expression value. Only the format part of fmt is used.
i/fmt addr [.index]
- Read I/O port.
o/fmt addr val
- Write to I/O port.
Send keys to the guest. keys could be the name of the key or the raw value in hexadecimal format. Use
-to press several keys simultaneously. Example:
This command is useful to send keys that your graphical user interface intercepts at low level, such as
ctrl-alt-f1in X Window.
- Enable, disable or reset synchronization profiling. With no arguments, prints whether profiling is on or off.
- Reset the system.
- Power down the system (if supported).
- Compute the checksum of a memory region.
- Add device.
- Remove device id. id may be a short ID or a QOM object path.
- Set the default CPU.
mouse_movedx dy [dz]
- Move the active mouse to the specified coordinates dx dy with optional scroll axis dz.
- Change the active mouse button state val (1=L, 2=M, 4=R).
Set which mouse device receives events at given index, index can be obtained with:
wavcapturefilename audiodev [frequency [bits [channels]]]
Capture audio into filename from audiodev, using sample rate frequency bits per sample bits and number of channels channels.
- Sample rate = 44100 Hz - CD quality
- Bits = 16
- Number of channels = 2 - Stereo
Stop capture with a given index, index can be obtained with:
memsaveaddr size file
- save to disk virtual memory dump starting at addr of size size.
pmemsaveaddr size file
- save to disk physical memory dump starting at addr of size size.
Define new values for the boot device list. Those values will override the values specified on the command line through the
The values that can be specified here depend on the machine type, but are the same that can be specified in the
-bootcommand line option.
- Inject an NMI on the default CPU (x86/s390) or all CPUs (ppc64).
- Write data to ring buffer character device device. data must be a UTF-8 string.
- Read and print up to size bytes from ring buffer character
Certain non-printable characters are printed
XXXXis the character code in hexadecimal. Character
\\. Bug: can screw up when the buffer contains invalid UTF-8 sequences, NUL characters, after the ring buffer lost data, and when reading stops because the size limit is reached.
- Trigger a round of GARP/RARP broadcasts; this is useful for explicitly updating the network infrastructure after a reconfiguration or some forms of migration. The timings of the round are set by the migration announce parameters. An optional comma separated interfaces list restricts the announce to the named set of interfaces. An optional id can be used to start a separate announce timer and to change the parameters of it later.
migrate [-d] [-b] [-i]uri
Migrate to uri (using -d to not wait for completion).
- for migration with full copy of disk
- for migration with incremental copy of disk (base image is shared)
- Cancel the current VM migration.
- Continue migration from the paused state state
- Continue an incoming migration using the uri (that has the same syntax
- Continue a paused incoming postcopy migration using the uri.
- Pause an ongoing migration. Currently it only supports postcopy.
- Enable/Disable the usage of a capability capability for migration.
- Set the parameter parameter for migration.
- Switch in-progress migration to postcopy mode. Ignored after the end of migration (or once already in postcopy).
- Tell COLO that heartbeat is lost, a failover or takeover is needed.
client_migrate_infoprotocol hostname port tls-port cert-subject
- Set migration information for remote display. This makes the server ask the client to automatically reconnect using the new parameters once migration finished successfully. Only implemented for SPICE.
dump-guest-memory [-p]filename begin length
Dump guest memory to protocol. The file can be processed with crash or gdb. Without
-z|-l|-s|-w, the dump format is ELF.
- do paging to get guest’s memory mapping.
- dump in kdump-compressed format, with zlib compression.
- dump in kdump-compressed format, with lzo compression.
- dump in kdump-compressed format, with snappy compression.
- dump in Windows crashdump format (can be used instead of ELF-dump converting), for Windows x64 guests with vmcoreinfo driver only
- dump file name.
- the starting physical address. It’s optional, and should be specified together with length.
- the memory size, in bytes. It’s optional, and should be specified together with begin.
- Save guest storage keys to a file.
- Enables or disables migration mode.
- Snapshot device, using snapshot file as target if provided
- Take an internal snapshot on device if it support
- Delete an internal snapshot on device if it support
- Start mirroring a block device’s writes to a new destination, using the specified target.
- Start a point-in-time copy of a block device to a specified target.
- Add drive to PCI storage controller.
- Inject PCIe AER error
- Add host network device.
- Remove host network device.
- Create QOM object.
- Destroy QOM object.
- Redirect TCP or UDP connections from host to guest (requires -net user).
- Remove host-to-guest TCP or UDP redirection.
- Request VM to change its memory allocation to value (in MB).
- Switch link name on (i.e. up) or off (i.e. down).
- Change watchdog action.
- Start an NBD server on the given host and/or port. If the
-aoption is included, all of the virtual machine’s block devices that have an inserted media on them are automatically exported; in this case, the
-woption makes the devices writable too.
nbd_server_adddevice [ name ]
- Export a block device through QEMU’s NBD server, which must be started
-woption makes the exported device writable too. The export name is controlled by name, defaulting to device.
- Stop exporting a block device through QEMU’s NBD server, which was
previously started with
-foption forces the server to drop the export immediately even if clients are connected; otherwise the command fails unless there are no clients.
- Stop the QEMU embedded NBD server.
mcecpu bank status mcgstatus addr misc
- Inject an MCE on the given CPU (x86 only).
- If a file descriptor is passed alongside this command using the SCM_RIGHTS mechanism on unix sockets, it is stored using the name fdname for later use by other monitor commands.
- Close the file descriptor previously assigned to fdname using the
getfdcommand. This is only needed if the file descriptor was never used by another monitor command.
block_set_io_throttledevice bps bps_rd bps_wr iops iops_rd iops_wr
- Change I/O throttle limits for a block drive to bps bps_rd bps_wr iops iops_rd iops_wr. device can be a block device name, a qdev ID or a QOM path.
set_password [ vnc | spice ] password [ action-if-connected ]
- Change spice/vnc password. Use zero to make the password stay valid forever. action-if-connected specifies what should happen in case a connection is established: fail makes the password change fail. disconnect changes the password and disconnects the client. keep changes the password and keeps the connection up. keep is the default.
expire_password [ vnc | spice ]expire-time
Specify when a password for spice/vnc becomes invalid. expire-time accepts:
- Invalidate password instantly.
- Password stays valid forever.
- Password stays valid for nsec seconds starting now.
- Password is invalidated at the given time. nsec are the seconds passed since 1970, i.e. unix epoch.
- chardev-add accepts the same parameters as the -chardev command line switch.
- chardev-change accepts existing chardev id and then the same arguments as the -chardev command line switch (except for “id”).
- Removes the chardev id.
- Send a break on the chardev id.
- Executes a qemu-io command on the given block device.
- Print QOM properties of object at location path
- Print QOM property property of object at location path
qom-setpath property value
- Set QOM property property of object at location path to value value
- Set replay breakpoint at instruction count icount.
Execution stops when the specified instruction is reached.
There can be at most one breakpoint. When breakpoint is set, any prior
one is removed. The breakpoint may be set only in replay mode and only
“in the future”, i.e. at instruction counts greater than the current one.
The current instruction count can be observed with
- Remove replay breakpoint which was previously set with
replay_break. The command is ignored when there are no replay breakpoints.
- Automatically proceed to the instruction count icount, when
replaying the execution. The command automatically loads nearest
snapshot and replays the execution to find the desired instruction.
When there is no preceding snapshot or the execution is not replayed,
then the command fails.
icount for the reference may be observed with
- Start a round of dirty rate measurement with the period specified in second.
The result of the dirty rate measurement may be observed with
Show various information about the system state.
- Show the version of QEMU.
- Show the network state.
- Show the character devices.
- Show info of one block device or all block devices.
- Show block device statistics.
- Show progress of ongoing block device operations.
- Show the cpu registers.
- Show local APIC state
- Show io APIC state
- Show infos for each CPU.
- Show the command line history.
- Show the interrupts statistics (if available).
- Show PIC state.
- Show RDMA state.
- Show PCI information.
- Show virtual to physical memory mappings.
- Show the active virtual memory mappings.
- Show memory tree.
- Show dynamic compiler info.
- Show dynamic compiler opcode counters
info sync-profile [-m|-n][max]
Show synchronization profiling info, up to max entries (default: 10), sorted by total wait time.
- sort by mean wait time
- do not coalesce objects with the same call site
When different objects that share the same call site are coalesced, the “Object” field shows—enclosed in brackets—the number of objects being coalesced.
- Show KVM information.
- Show NUMA information.
- Show guest USB devices.
- Show host USB devices.
- Show profiling information.
- Show capture information.
- Show the currently saved VM snapshots.
- Show the current VM status (running|paused).
- Show which guest mouse is receiving events.
- Show the vnc server status.
- Show the spice server status.
- Show the current VM name.
- Show the current VM UUID.
- Show user network stack connection states.
- Show migration status.
- Show current migration capabilities.
- Show current migration parameters.
- Show balloon information.
- Show device tree.
- Show qdev device model list.
- Show QOM composition tree.
- Show roms.
- Show available trace-events & their state.
- Show the TPM device.
- Show memory backends
- Show memory devices.
- Show iothread’s identifiers.
- Show rocker switch.
- Show rocker ports.
info rocker-of-dpa-flowsname [tbl_id]
- Show rocker OF-DPA flow tables.
info rocker-of-dpa-groupsname [type]
- Show rocker OF-DPA groups.
- Display the value of a storage key (s390 only)
- Display the values of the CMMA storage attributes for a range of pages (s390 only)
- Display the latest dump status.
- Dump all the ramblocks of the system.
- Show information about hotpluggable CPUs
- Show Virtual Machine Generation ID
- Display the amount of initially allocated and present hotpluggable (if enabled) memory in bytes.
- Show SEV information.
- Display the record/replay information: mode and the current icount.
- Display the vcpu dirty rate information.
The monitor understands integers expressions for every integer argument. You can use register names to get the value of specifics CPU registers by prefixing them with $.