Qemu Quick Ref + KVM + Virsh

From Bitbull Wiki
Revision as of 08:13, 24 January 2023 by Chris (talk | contribs)
Jump to navigation Jump to search

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 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 /srv/kvm/raid5/foreman01_6.qvm-bkp
  • delete snapshot meta data
virsh snapshot-delete $VM snap_name --metadata