qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Taeha Kim <kthguru@gmail.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, 김태하 <thlab.kim@samsung.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] No change in userland tools after resizing qcow2 image
Date: Sun, 19 Jul 2015 19:48:36 +0200	[thread overview]
Message-ID: <55ABE2F4.7060305@redhat.com> (raw)
In-Reply-To: <CADsSMSfvpLASW4_xb5x7jhA2uFZw7YNCE=1ojx6s3D+=5ji26Q@mail.gmail.com>



On 19/07/2015 11:15, Taeha Kim wrote:
> However, the "ls", “stat”, and “du” utility still don't know how many
> change size of image is changed.

That's not a bug.  qcow2 images only need as much space as required,
plus some for the metadata.  This lets you use small files, and copy
them around without relying on the filesystem's support for sparse files.

> In addtion, "file" utility sometimes don't know qcow2 image format's
> version as follows.
> 
> $ file 100G.qcow2
> 100G.qcow2: QEMU QCOW Image (Unknown)

Use qemu-img info instead, or report a bug for the file utility.

The patch below does not work correctly because:

1) bs->filename is not always valid;

2) even if bs->filename is valid, truncate() does not apply to all
backends, for example it cannot be applied to the backends where
bs->filename is a URL;

3) it can corrupt the image if it is larger than the requested size (for
example because of the metadata).

Paolo

> diff --git a/block.c b/block.c
> index d088ee0..93427f8 100644
> --- a/block.c
> +++ b/block.c
> @@ -2529,6 +2529,9 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset)
>         if (bs->blk) {
>             blk_dev_resize_cb(bs->blk);
>         }
> +       if (ret == 0) {
> +           ret = truncate(bs->filename, offset);
> +       }
>     }
>     return ret;
> }

      reply	other threads:[~2015-07-19 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-19  9:15 [Qemu-devel] No change in userland tools after resizing qcow2 image Taeha Kim
2015-07-19 17:48 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55ABE2F4.7060305@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kthguru@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thlab.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).