On Tue 14 Apr 2020 08:06:38 PM CEST, Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> wrote: >>> In other words, cluster can't be unallocated with data file in use. >> >> I still don't follow... clusters can be unallocated, and when you >> create a new image they are indeed unallocated. > > with external data file? Than we probably need to fix spec.. > > unallocated mean that offset is 0, and bit 63 is unset. But this can't > be when and exernal data file is used, accordingly to the spec. > > Or what am I missing?
$ qemu-img create -f qcow2 -o data_file=data.raw img.qcow2 1M $ qemu-io -c 'write 0 192k' img.qcow2 $ qemu-io -c 'write -z -u 64k 64k' img.qcow2 Clusters #0 and #2 are allocated (offsets 0x00000 and 0x20000), cluster #1 is unallocated (offset 0, bit 63 unset, bit 0 -all zeroes- set). Berto