Qemu Quick Ref + KVM + Virsh
Jump to navigation
Jump to search
Contents
1 facts
- get disks
virsh domblklist $VM
- disk info
qemu-img info $VM_IDISK
- get ip adress of vm
virsh qemu-agent-command $VM '{"execute":"guest-network-get-interfaces"}' | python3 -mjson.tool | grep ip-address
2 resize
- resize image
qemu-img resize $VM_IDISK 100G
3 convert
- Error: Cannot store dirty bitmaps in qcow2 v2 files
qemu-img convert -O qcow2 -o compat=1.1 old-image.qcow2 new-image.qcow2
4 snapshot
- list snapshots with virsh
virsh snapshot-list $VM
- commit snapshot from online vm
virsh blockcommit $VM $VM_IDISK --active --pivot --verbose
- commit snapshot from powered-off vm
qemu-img commit $VM_DISK_DELTA_FILE
- delete snapshot meta data
virsh snapshot-delete $VM snap_name --metadata
- delete snapshot within qcow2 file
qemu-img snapshot -d $SNAP_NAME $VM_DISK