(Prompted by a user query on IRC.)

In our documentation for "virtual FAT disk images"
https://www.qemu.org/docs/master/system/images.html#virtual-fat-disk-images

we say that you can use a command line like:
 qemu-system-x86_64 linux.img -hdb fat:/my_directory

to get a disk image with (default) read-only access to the host
filesystem. However, if you try this it gives a warning and an error:

$ ./build/x86-tgts/qemu-system-x86_64 -hdb fat:/tmp/zz9
WARNING: Image format was not specified for 'json:{"fat-type": 0,
"dir": "/tmp/zz9", "driver": "vvfat", "floppy": false, "rw": false}'
and probing guessed raw.
         Automatically detecting the format is dangerous for raw
images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: Block node is read-only


The first of these seems nonsensical -- why is this fake FAT disk
image going through the "auto-detect format" code ? The "image"
the vvfat code presents to the rest of the block system should
always be raw by definition, I would have thought.

The second of them is a fatal error, and means the command line as
we have documented it just doesn't work. Specifying "fat:rw:/dir"
works because then the FAT backend is read-write -- but how should
the user tell QEMU "no, I really do want just read access" here ?

Presumably at some point we added some extra validation on
whether a block backend is read-only, and never updated the
FAT disk image docs accordingly ?

thanks
-- PMM

Reply via email to