[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v5 0/4] Add shrink image for qcow2
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v5 0/4] Add shrink image for qcow2 |
Date: |
Wed, 12 Jul 2017 16:04:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 2017-07-12 13:46, Pavel Butsykin wrote:
> This patch add shrinking of the image file for qcow2. As a result, this allows
> us to reduce the virtual image size and free up space on the disk without
> copying the image. Image can be fragmented and shrink is done by punching
> holes
> in the image file.
>
> # ./qemu-img create -f qcow2 image.qcow2 4G
> Formatting 'image.qcow2', fmt=qcow2 size=4294967296 encryption=off
> cluster_size=65536 lazy_refcounts=off refcount_bits=16
>
> # ./qemu-io -c "write -P 0x22 0 1G" image.qcow2
> wrote 1073741824/1073741824 bytes at offset 0
> 1 GiB, 1 ops; 0:00:04.59 (222.886 MiB/sec and 0.2177 ops/sec)
>
> # ./qemu-img resize image.qcow2 512M
> warning: qemu-img: Shrinking an image will delete all data beyond the
> shrunken image's end. Before performing such an operation, make sure there is
> no important data there.
> error: qemu-img: Use the --shrink option to perform a shrink operation.
>
> # ./qemu-img resize --shrink image.qcow2 128M
> Image resized.
>
> # ./qemu-img info image.qcow2
> image: image.qcow2
> file format: qcow2
> virtual size: 128M (134217728 bytes)
> disk size: 128M
> cluster_size: 65536
> Format specific information:
> compat: 1.1
> lazy refcounts: false
> refcount bits: 16
> corrupt: false
>
> # du -h image.qcow2
> 129M image.qcow2
Thanks, looks good. Now we'll just have to wait for the warn_report()
series.
Max
signature.asc
Description: OpenPGP digital signature
[Qemu-block] [PATCH v5 2/4] qcow2: add qcow2_cache_discard, Pavel Butsykin, 2017/07/12
[Qemu-block] [PATCH v5 1/4] qemu-img: add --shrink flag for resize, Pavel Butsykin, 2017/07/12
[Qemu-block] [PATCH v5 4/4] qemu-iotests: add shrinking image test, Pavel Butsykin, 2017/07/12
Re: [Qemu-block] [PATCH v5 0/4] Add shrink image for qcow2,
Max Reitz <=