* kvm-87: qemu-img creates raw file with wrong size
@ 2009-07-13 21:37 Randy Smith
2009-07-13 21:40 ` Anthony Liguori
0 siblings, 1 reply; 4+ messages in thread
From: Randy Smith @ 2009-07-13 21:37 UTC (permalink / raw)
To: KVM list
[-- Attachment #1: Type: text/plain, Size: 472 bytes --]
Greetings,
Running `qemu-img create -f raw file.raw 1000` creates a 512 byte file
rather than the 1000K file the docs imply.
From the help message:
"
'size' is the disk image size in kilobytes. Optional suffixes
'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 * 1024 * 1024) are
supported any 'k' or 'K' is ignored
"
Did the default change or is there bug with the create?
--
Randy Smith
http://www.vuser.org/
http://perlstalker.blogspot.com/
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kvm-87: qemu-img creates raw file with wrong size
2009-07-13 21:37 kvm-87: qemu-img creates raw file with wrong size Randy Smith
@ 2009-07-13 21:40 ` Anthony Liguori
2009-07-13 21:48 ` Randall Smith
0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2009-07-13 21:40 UTC (permalink / raw)
To: Randy Smith; +Cc: KVM list
Randy Smith wrote:
> Greetings,
>
> Running `qemu-img create -f raw file.raw 1000` creates a 512 byte file
> rather than the 1000K file the docs imply.
>
> From the help message:
> "
> 'size' is the disk image size in kilobytes. Optional suffixes
> 'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 * 1024 * 1024) are
> supported any 'k' or 'K' is ignored
> "
>
> Did the default change or is there bug with the create?
>
No suffix assumes bytes. It truncates to the nearest sector which is
why you see a 512 byte file. If you did `qemu-img create -f raw
file.raw 1024` you would see a file of 1024 bytes.
Not sure if the docs is wrong or this behavior changed. Patch either
way would be appreciated/accepted.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kvm-87: qemu-img creates raw file with wrong size
2009-07-13 21:40 ` Anthony Liguori
@ 2009-07-13 21:48 ` Randall Smith
2009-07-13 22:15 ` Lynn Kerby
0 siblings, 1 reply; 4+ messages in thread
From: Randall Smith @ 2009-07-13 21:48 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm
On Mon, Jul 13, 2009 at 3:40 PM, Anthony Liguori<anthony@codemonkey.ws> wrote:
> Randy Smith wrote:
>>
>> Greetings,
>>
>> Running `qemu-img create -f raw file.raw 1000` creates a 512 byte file
>> rather than the 1000K file the docs imply.
>>
>> From the help message:
>> "
>> 'size' is the disk image size in kilobytes. Optional suffixes
>> 'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 * 1024 * 1024) are
>> supported any 'k' or 'K' is ignored
>> "
>>
>> Did the default change or is there bug with the create?
>>
>
> No suffix assumes bytes. It truncates to the nearest sector which is why
> you see a 512 byte file. If you did `qemu-img create -f raw file.raw 1024`
> you would see a file of 1024 bytes.
>
> Not sure if the docs is wrong or this behavior changed. Patch either way
> would be appreciated/accepted.
It looks like the behavior changed. The ubuntu-vm-builder depended on
'size' defaulting to kilobytes and the help message printed when
qemu-img is run claims that it should default to kilobytes.
Here's a patch that updates the help message. It doesn't matter to me
if the behavior changed here but as long as the docs match what's
really happening.
--- qemu-img.c.orig 2009-07-13 15:42:49.000000000 -0600
+++ qemu-img.c 2009-07-13 15:43:11.000000000 -0600
@@ -78,7 +78,7 @@
" content as the input's base image, however the path,
image format, etc may\n"
" differ\n"
" 'fmt' is the disk image format. It is guessed
automatically in most cases\n"
- " 'size' is the disk image size in kilobytes. Optional suffixes\n"
+ " 'size' is the disk image size in bytes. Optional suffixes\n"
" 'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 *
1024 * 1024) are\n"
" supported any 'k' or 'K' is ignored\n"
" 'output_filename' is the destination disk image filename\n"
--
Randy Smith
http://www.vuser.org/
http://perlstalker.blogspot.com/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: kvm-87: qemu-img creates raw file with wrong size
2009-07-13 21:48 ` Randall Smith
@ 2009-07-13 22:15 ` Lynn Kerby
0 siblings, 0 replies; 4+ messages in thread
From: Lynn Kerby @ 2009-07-13 22:15 UTC (permalink / raw)
To: Randall Smith; +Cc: kvm
On Jul 13, 2009, at 2:48 PM, Randall Smith wrote:
> On Mon, Jul 13, 2009 at 3:40 PM, Anthony
> Liguori<anthony@codemonkey.ws> wrote:
>> Randy Smith wrote:
>>>
>>> Greetings,
>>>
>>> Running `qemu-img create -f raw file.raw 1000` creates a 512 byte
>>> file
>>> rather than the 1000K file the docs imply.
>>>
>>> From the help message:
>>> "
>>> 'size' is the disk image size in kilobytes. Optional suffixes
>>> 'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 * 1024 * 1024)
>>> are
>>> supported any 'k' or 'K' is ignored
>>> "
>>>
>>> Did the default change or is there bug with the create?
>>>
>>
>> No suffix assumes bytes. It truncates to the nearest sector which
>> is why
>> you see a 512 byte file. If you did `qemu-img create -f raw
>> file.raw 1024`
>> you would see a file of 1024 bytes.
>>
>> Not sure if the docs is wrong or this behavior changed. Patch
>> either way
>> would be appreciated/accepted.
>
> It looks like the behavior changed. The ubuntu-vm-builder depended on
> 'size' defaulting to kilobytes and the help message printed when
> qemu-img is run claims that it should default to kilobytes.
>
> Here's a patch that updates the help message. It doesn't matter to me
> if the behavior changed here but as long as the docs match what's
> really happening.
>
> --- qemu-img.c.orig 2009-07-13 15:42:49.000000000 -0600
> +++ qemu-img.c 2009-07-13 15:43:11.000000000 -0600
> @@ -78,7 +78,7 @@
> " content as the input's base image, however the path,
> image format, etc may\n"
> " differ\n"
> " 'fmt' is the disk image format. It is guessed
> automatically in most cases\n"
> - " 'size' is the disk image size in kilobytes. Optional
> suffixes\n"
> + " 'size' is the disk image size in bytes. Optional
> suffixes\n"
> " 'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 *
> 1024 * 1024) are\n"
> " supported any 'k' or 'K' is ignored\n"
> " 'output_filename' is the destination disk image
> filename\n"
The help message is still incorrect. The 'k' or 'K' suffix is
supported also and not ignored like the message says.
Lynn Kerby
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-13 23:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13 21:37 kvm-87: qemu-img creates raw file with wrong size Randy Smith
2009-07-13 21:40 ` Anthony Liguori
2009-07-13 21:48 ` Randall Smith
2009-07-13 22:15 ` Lynn Kerby
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.