KVM / Qemu

Create an image

qemu-img create -f qcow2 disk.img 4G

Install a machine

qemu-kvm -m 1024 -boot -once=d -cdrom cd.iso disk.img

Start a machine

qemu-kvm -m 1024 disk.img

Start qemu monitor

qemu-kvm -m 1024 disk.img -monitor stdin

Convert virtualbox or vmware image

qemu-img convert -O qcow2 Platte.(vdi|vmdk) Platte.img

Convert to older Qcow version

qemu-img convert disk.img -O qcow2 -o compat=0.10 -c disk-2.img

Resize disk

  • Switch off machine
  • Resize only disk image (filesystem left alone)
qemu-img resize disk.img +10G
  • Or create a new bigger image
qemu-img create -f qcow2 new-disk.img 20G

Disk encryption

  • Create
qemu-img create -e -f qcow2 disk.img 10G
  • Convert
qemu-img convert -e -O qcow2 disk.img disc-enc.img