Troubleshoot qemu VM

Start minimal vm

Run this command. If it works, your configuration is correct.

qemu-system-x86_64 -enable-kvm -m 1024 \
  -drive file=debian-12-generic-amd64.qcow2,format=qcow2 \
  -nographic -serial mon:stdio

Mount qcow2 disk

Load the nbd module:

sudo modprobe nbd

Connect the qcow2 disk:

sudo qemu-nbd --connect=/dev/nbd0 debian-12-generic-amd64.qcow2

(Optional) Mount a partition from the connected disk:

sudo mount /dev/nbd0p1 /mnt

Unmount the partition if mounted:

sudo umount /mnt

Disconnect the disk:

sudo qemu-nbd --disconnect /dev/nbd0

Remove the nbd module:

sudo modprobe -r nbd

Published:

Last updated:

Category: Linux

Comments

Leave a comment