Re: kvm-87: qemu-img creates raw file with wrong size

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

 




On Jul 13, 2009, at 2:48 PM, Randall Smith wrote:

On Mon, Jul 13, 2009 at 3:40 PM, Anthony Liguori<anthony@xxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux