Passing a block device to Qemu 3.0.1 like this works but yields a deprecation warning:

-blockdev file,node-name=f1,filename=/dev/loop0 \
-blockdev raw,node-name=q1,file=f1 \
-device virtio-blk,drive=q1

The warning:

qemu-system-x86_64: -blockdev file,node-name=f1,filename=/dev/loop0: 
  warning: Opening a block device as a file using the 'file' driver
    is deprecated

Fair enough, but how do I pass a block device to qemu without using the 'file' driver?

1 Answer 1


You should use host_device instead, which is admittedly difficult since it’s not documented.

In your case, the non-deprecated options are

-blockdev node-name=q1,driver=raw,file.driver=host_device,file.filename=/dev/loop0 \
-device virtio-blk,drive=q1
  • Great find! This works. Btw, meanwhile I've worked around this with -drive file=/dev/loop0,if=none,format=raw,aio=native,cache=none,id=q1 -device virtio-blk,drive=q1 although I remember a qemu Fosdem 2018 talk where the speaker categorized -drive as legacy option. With -drive the warning also goes away, so perhaps qemu translates it into a driver=host_device setup. Or it does something completely different ... :) Nov 10, 2019 at 16:20
  • never heard -drive labelled as legacy option before. manpage mentions no such thing either (it does for other legacy options) Nov 10, 2019 at 16:39
  • 1
    @frostschutz Thomas Huth. Finding your way through the QEMU paramter jungle. Fosdem 2018 especially pages 10, 20 and 23. Nov 10, 2019 at 16:45
  • @maxschlepzig Interesting, thanks for the link. Even for just released qemu-4.2.0-rc, the documentation does not seem to reflect this at all. Nov 10, 2019 at 18:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .