3

I am trying to get my drive to show up in QEMU guest virtual Linux machine.

desired behavior:

$ ls /dev/disk/by-id/
ata-CT1000MX500SSD4_XXXXXX

Current behavior returns nothing:

$ ls /dev/disk/by-id/

Here is how I created my disk image:

qemu-img create -f raw disk1.img 20G

and here is how I am launghing my VM to boot the archlive iso:

qemu-system-x86_64 \
   -m 12G \
   -boot d \
   -enable-kvm \
   -cpu host \
   -smp 2 \
   -net nic \
   -net user,hostfwd=tcp::2222-:22 \
   -vga virtio \
   -drive format=raw,file=disk1.img,index=0,if=virtio \
   -drive file=${HOME}/dl/iso/arch.iso,index=1,media=cdrom,readonly \
   -drive if=pflash,format=raw,readonly,file=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd \
   -drive if=pflash,format=raw,file=uefi_vars.fd

I've tried modifiying the drive .img drive entry adding serial=001 like so:

   -drive format=raw,file=disk1.img,index=0,serial=001,if=virtio \

but this returns the error:

qemu-system-x86_64: -drive format=raw,file=disk1.img,index=0,serial=001,if=virtio: Block format 'raw' does not support the option 'serial'

So is my problem that I am using raw format?

If so, what format would work?

Can you show me how to change my commands to allow for UUIDs in my Virtual Machine?

EDIT: I tried building the VM with .qcow2 and used format=qcow2 but get the same error message: format 'qcow2' does not support the option 'serial'

posop
  • 247
  • 2
  • 10

1 Answers1

0

I have a quite recent version of qemu, but this ended up working for me:

sudo ./qemu/build/ppc64-softmmu/qemu-system-ppc64 \
   -m 2G -M pseries-2.12,accel=kvm -nographic -vga none -smp 4 \
   -blockdev filename=/scratch/libvirt/sle15sp2.qcow2,node-name=storage,driver=file \
   -blockdev driver=qcow2,file=storage,node-name=disk \
   -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=disk,id=virtio-disk0,bootindex=1

Sadly I can't tell you why this works.

dja
  • 151
  • 2