Difference between revisions of "Qemu Quick Ref + KVM + Virsh"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | =facts= | |
− | + | * get disks | |
− | * | + | virsh domblklist $VM |
− | + | * disk info | |
− | + | qemu-img info $VM_IDISK | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | * | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | qemu - | ||
− | |||
− | |||
− | * | + | * get ip adress of vm |
− | + | virsh qemu-agent-command $VM '{"execute":"guest-network-get-interfaces"}' | python3 -mjson.tool | grep ip-address | |
− | qemu- | ||
− | + | =resize= | |
− | qemu - | + | * resize image |
+ | qemu-img resize $VM_IDISK 100G | ||
− | + | =convert= | |
− | qemu-img convert -O | + | * Error: Cannot store dirty bitmaps in qcow2 v2 files |
+ | qemu-img convert -O qcow2 -o compat=1.1 old-image.qcow2 new-image.qcow2 | ||
− | + | =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 | ||
[[Category:KVM]] | [[Category:KVM]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
+ | [[Category:ReferenceCards]] |
Latest revision as of 06:41, 23 December 2023
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