Using qcow2 format, it also doesn't appear to work: $ /tmp/sparsetest.sh Formatting '/tmp/test1', fmt=qcow2 size=104857600 encryption=off cluster_size=65536 lazy_refcounts=off Formatting '/tmp/test2', fmt=qcow2 size=104857600 encryption=off cluster_size=65536 lazy_refcounts=off 136K /tmp/test1 136K /tmp/test2 Read Capacity results: Protection: prot_en=0, p_type=0, p_i_exponent=0 Logical block provisioning: lbpme=1, lbprz=0 Last logical block address=204799 (0x31fff), Number of logical blocks=204800 Logical block length=512 bytes Logical blocks per physical block exponent=0 Lowest aligned logical block address=0 Hence: Device size: 104857600 bytes, 100.0 MiB, 0.10 GB Block limits VPD page (SBC): Write same no zero (WSNZ): 1 Maximum compare and write length: 0 blocks Optimal transfer length granularity: 0 blocks Maximum transfer length: 0 blocks Optimal transfer length: 0 blocks Maximum prefetch length: 0 blocks Maximum unmap LBA count: 2097152 Maximum unmap block descriptor count: 255 Optimal unmap granularity: 8 Unmap granularity alignment valid: 0 Unmap granularity alignment: 0 Maximum write same length: 0x0 blocks
17M /tmp/test1 17M /tmp/test2 $ ll -h /tmp/test{1,2} -rw-r--r--. 1 rjones rjones 17M Jan 7 21:24 /tmp/test1 -rw-r--r--. 1 rjones rjones 17M Jan 7 21:24 /tmp/test2 $ qemu-img info /tmp/test1 image: /tmp/test1 file format: qcow2 virtual size: 100M (104857600 bytes) disk size: 16M cluster_size: 65536 $ qemu-img info /tmp/test2 image: /tmp/test2 file format: qcow2 virtual size: 100M (104857600 bytes) disk size: 16M cluster_size: 65536 ---------------------------------------------------------------------- A frustrating aspect of this is there's no diagnostics or way to probe if UNMAP is supported all the way through. This will be critical for virt-sparsify, since we'd like to be able to tell the user in advance whether or not in-place sparsification is going to work, and even better, why not. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org