qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "relaxed" `-hda file.qcow2` equivalent ?


From: Frantisek Rysanek
Subject: Re: "relaxed" `-hda file.qcow2` equivalent ?
Date: Fri, 15 Nov 2024 15:10:02 +0100

Hmm. By now I'm thinking aloud.

According to the manpage (see below), "-blockdev" is the most "down 
to earth", true and modern way to specify the emulated disk - 
possibly needs to be combined with a "-device" to specify the 
guest-side emulated interface? Curiously, I cannot find a complete 
example... 

The manpage says, that:
-hda (etc) is the oldest form, nowadays a macro for -drive + -device 
(controller).
-drive is a shorthand for "-blockdev + -device"
So... where I'm using -drive, I might as well be using -blockdev .
Plus something more? No clue... :-)
Or perhaps use "-blockdev node-name=.." instead of "-drive id=.." ?

The qemu docs chapter on "QEMU block drivers" gives this example:

-blockdev 
driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver
=file

I.e., you should put your locking=off option into a -blockdev 
definition as you say.

And, I have an idea: rather than refer to driver=qcow2 and 
file.filename, how about referring to the loopback device (NBD) that 
you already have, courtesy of qemu-nbd ? Would that perhaps 
circumvent the file lock? ;-)

-blockdev node-name=xy,driver=raw,file.driver=host_device,\
file.filename=/dev/loop0,file.locking=off

-device virtio-scsi-pci -device scsi-hd,drive=xy 


Further reading:

https://manpages.debian.org/testing/qemu-system-x86/qemu-system-x86_64
.1.en.html#Block_device_options

https://unix.stackexchange.com/questions/753092/what-is-the-difference
-between-these-two-blockdev-declarations

https://www.qemu.org/docs/master/system/qemu-block-drivers.html#disk-i
mage-file-locking


Frank



reply via email to

[Prev in Thread] Current Thread [Next in Thread]