Re: base format

2024-04-25 Thread Jakob Bohm via

On 2024-04-25 14:51, lacsaP Patatetom wrote:
Le jeu. 25 avr. 2024 à 11:30, Peter Maydell > a écrit :


On Thu, 25 Apr 2024 at 09:55, lacsaP Patatetom
mailto:patate...@gmail.com>> wrote:
>
> hi,
>
> when using `qemu-img create`, why do I have to specify the
format of the base image ?
> can't `qemu-img` detect it itself ?

Image format detection isn't 100% reliable. Notably, a 'raw'
format image could in theory look like any of the other
image types if it happens to start with the right kind of data.

thanks
-- PMM


OK for the raw format, which can be anything, but not for the qcow2 
format, which is standardized (header).
in the absence of details, `qemu-img` could use the qcow2 format by 
default ?


qemu-img create [-b base [-F (qcow2*|raw)]] [-f (qcow2*|raw)] image [size]
But it cannot safely tell if the base file (usually a raw image or raw 
physical
disk partition) is qcow2 or araw file that just happens to begin with 
the magic

bytes that represent qcow2.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded




Re: base format

2024-04-25 Thread Alberto Garcia
On Thu, Apr 25, 2024 at 02:51:28PM +0200, lacsaP Patatetom wrote:
> > > when using `qemu-img create`, why do I have to specify the
> > > format of the base image ? can't `qemu-img` detect it itself ?
> >
> > Image format detection isn't 100% reliable. Notably, a 'raw'
> > format image could in theory look like any of the other image
> > types if it happens to start with the right kind of data.
> >
> OK for the raw format, which can be anything, but not for the qcow2
> format, which is standardized (header).
> in the absence of details, `qemu-img` could use the qcow2 format by
> default ?

You probably don't want the integrity of your data to depend on
whether QEMU detects correctly the format of the backing file every
time you open it.

If the problem is that you have to type extra characters every time
you create an image that can be easily solved with a shell script or
an alias.

Berto



Re: base format

2024-04-25 Thread lacsaP Patatetom
Le jeu. 25 avr. 2024 à 11:30, Peter Maydell  a
écrit :

> On Thu, 25 Apr 2024 at 09:55, lacsaP Patatetom 
> wrote:
> >
> > hi,
> >
> > when using `qemu-img create`, why do I have to specify the format of the
> base image ?
> > can't `qemu-img` detect it itself ?
>
> Image format detection isn't 100% reliable. Notably, a 'raw'
> format image could in theory look like any of the other
> image types if it happens to start with the right kind of data.
>
> thanks
> -- PMM
>

OK for the raw format, which can be anything, but not for the qcow2 format,
which is standardized (header).
in the absence of details, `qemu-img` could use the qcow2 format by default
?

qemu-img create [-b base [-F (qcow2*|raw)]] [-f (qcow2*|raw)] image [size]


Re: base format

2024-04-25 Thread Peter Maydell
On Thu, 25 Apr 2024 at 09:55, lacsaP Patatetom  wrote:
>
> hi,
>
> when using `qemu-img create`, why do I have to specify the format of the base 
> image ?
> can't `qemu-img` detect it itself ?

Image format detection isn't 100% reliable. Notably, a 'raw'
format image could in theory look like any of the other
image types if it happens to start with the right kind of data.

thanks
-- PMM



base format

2024-04-25 Thread lacsaP Patatetom
hi,

when using `qemu-img create`, why do I have to specify the format of the
base image ?
can't `qemu-img` detect it itself ?
I understand that I have to specify the format of the created image, but I
don't understand for the base image.

`qemu-img create -b base.img -f qcow2 new.img`
rather than
`qemu-img create -b base.img -F qcow2 -f qcow2 new.img`

regards, lacsaP.