最後更新: 2024-09-27
目錄
QEMU Monitor
Help
https://qemu-project.gitlab.io/qemu/system/monitor.html
QEMU Monitor Listening on X
-monitor dev # stdio in non graphical mode
e.g. 使用 telnet 作 dev
-monitor telnet:localhost:24001,server,nowait
nowait # 必須加上
QEMU should not block waiting for a client to connect
連接
telnet localhost 24001
Escape character is '^]'. QEMU 5.2.0 monitor - type 'help' for more information (qemu)
Ctrl-Alt-n
- 1 Target system display
- 2 Monitor
- 3 Serial port
Ctrl-a c
Switch between console and monitor
- info X
- quit # Quit the emulator !!
info
(qemu) info status
VM status: running
(qemu) info block
drive-ide0-0-0 (#block139): /mnt/raid/VMs/ros/ros.qcow2 (qcow2) Attached to: ide0-0-0 Cache mode: writeback drive-ide0-1-0 (#block320): /mnt/raid/iso/systemrescuecd/systemrescue-9.03-amd64.iso (raw, read-only) Attached to: ide0-1-0 Removable device: not locked, tray closed Cache mode: writeback
(qemu) info vnc
default: Server: 192.168.33.1:5919 (ipv4) Auth: none (Sub: none)
(qemu) info network
virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:88:88:01 \ __org.qemu.nic0: index=0,type=tap,ifname=ros-wan,script=no,downscript=/etc/qemu-ifdown virtio-net-pci.1: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:88:88:02 \ __org.qemu.nic1: index=0,type=tap,ifname=ros-lan,script=no,downscript=/etc/qemu-ifdown
Stop, Resume, Reset, Wakeup
- stop # Pasue
- c|cont # Resume
- system_powerdown # send system power down event
- system_reset
- system_wakeup # wakeup guest from suspend
Snapshot
- savevm [tag]
If no tag is provided, a new snapshot is created.
- info snapshots
List of snapshots present on all disks: ID TAG VM SIZE DATE VM CLOCK ICOUNT -- vm-20240927101016 55.9 MiB 2024-09-27 10:10:16 00:24:18.516
- loadvm tag
e.g. loadvm vm-20240927101016
- delvm tag # delete a VM snapshot from its tag
...
-
commit device|all # commit changes to the disk images
(if -snapshot is used)
ISO
- eject [-f] device # eject a removable medium (use -f to force it)
e.g. eject drive-ide0-1-0
- change device setting # Change the configuration of a device.
e.g. change drive-ide0-1-0 /path/to/some.iso
Notes
可以用 "info block" 查看有什麼 device
boot_set bootdevice
define new values for the boot device list
sendkey
e.g. 'sendkey ctrl-alt-f1'
set_link name on|off -- change the link status of a network adapter
e.g.
set_link virtio-net-pci.0 off
USB Port & Device
Guest 有什麼 Devices
info usb
# 沒 USB 時
USB support not enabled
OR
Device 0.1, Port 6, Speed 12 Mb/s, Product QEMU USB Tablet Device 0.0, Port 1, Speed 1.5 Mb/s, Product USB Host Device
Host 有什麼 Devices
info usbhost
Bus 1, Addr 2, Port 1, Speed 480 Mb/s Hub: USB device 8087:0024 Bus 2, Addr 2, Port 1, Speed 480 Mb/s Hub: USB device 8087:0024 Auto filters: Bus *, Addr *, Port *, ID 0471:485d
usb_add device
# add USB device
e.g.
# Format: 'host:bus.addr' or 'host:vendor_id:product_id'
usb_add host:2.8
usb_del device
remove USB device 'bus.addr'