# QEMU Monitor¶

QEMU monitor

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.

## Commands¶

The following commands are available:

help or ? [cmd]
help

Show the help for all commands or just for command cmd.

commit
commit

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.

q or quit
quit

Quit the emulator.

block_resize
block_resize

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.

block_stream
block_stream

Copy data from a backing file into a block device.

block_job_set_speed
block_job_set_speed

Set maximum speed for a background block operation.

block_job_cancel
block_job_cancel

Stop an active background block operation (streaming, mirroring).

block_job_complete
block_job_complete

Manually trigger completion of an active background block operation. For mirroring, this will switch the device to the destination path.

block_job_pause
block_job_pause

Pause an active block streaming operation.

block_job_resume
block_job_resume

Resume a paused block streaming operation.

eject [-f] device
eject

Eject a removable medium (use -f to force it).

drive_del device
drive_del

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 device setting
change

Change the configuration of a device.

change diskdevice 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:

retain
Retains the current status; this is the default.
Makes the device read-only.
Makes the device writable.
change vnc display,options

Change the configuration of the VNC server. The valid syntax for display and options are described at sec_invocation. eg

(qemu) change vnc localhost:1


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

screendump filename
screendump

Save screen into PPM image filename.

logfile filename
logfile

Output logs to filename.

trace-event
trace-event

changes status of a trace event

trace-file on|off|flush
trace-file

Open, close, or flush the trace file. If no argument is given, the status of the trace file is displayed.

log item1[,...]
log

Activate logging of the specified items.

savevm [tag|id]
savevm

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 or ID, it is replaced. More info at vm_snapshots.

Set the whole virtual machine to the snapshot identified by the tag tag or the unique snapshot ID id.

delvm tag|id
delvm

Delete the snapshot identified by tag or id.

singlestep [off]
singlestep

Run the emulation in single step mode. If called with option off, the emulation returns to normal mode.

stop
stop

Stop emulation.

c or cont
cont

Resume emulation.

system_wakeup
system_wakeup

Wakeup guest from suspend.

gdbserver [port]
gdbserver

Start gdbserver session (default port=1234)

x

Virtual memory dump starting at addr.

xp

Physical memory dump starting at addr.

fmt is a format which tells the command how to format the data. Its syntax is: /{count}{format}{size}

count
is the number of items to be dumped.
format
can be x (hex), d (signed decimal), u (unsigned decimal), o (octal), c (char) or i (asm instruction).
size
can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86, h or w can be specified with the i format to respectively select 16 or 32 bit code instruction size.

Examples:

• Dump 10 instructions at the current instruction pointer: