Description of problem: QEMU support preallocation mode for luks format now, actually I can use it when creating the a luks image, but the image is not preallocated. RHEL7 has the same bugs: https://bugzilla.redhat.com/show_bug.cgi?id=1534951#c4 https://bugzilla.redhat.com/show_bug.cgi?id=1594864 Version-Release number of selected component (if applicable): QEMU version (fast train) # /usr/libexec/qemu-kvm --version QEMU emulator version 3.0.0 (qemu-kvm-3.0.0-2.module+el8+2208+e41b12e0) How reproducible: 100% Steps to Reproduce: 1. Check the support options # qemu-img create -f luks --object secret,id=sec0,data=test -o key-secret=sec0 test.luks 1G -o ? Supported options: size Virtual disk size key-secret ID of the secret that provides the keyslot passphrase cipher-alg Name of encryption cipher algorithm cipher-mode Name of encryption cipher mode ivgen-alg Name of IV generator algorithm ivgen-hash-alg Name of IV generator hash algorithm hash-alg Name of encryption hash algorithm iter-time Time to spend in PBKDF in milliseconds nocow Turn off copy-on-write (valid only on btrfs) preallocation Preallocation mode (allowed values: off, falloc, full) 2. Create a luks image with full mode # qemu-img create -f luks --object secret,id=sec0,data=testfull -o key-secret=sec0 testfull.luks 1G -o preallocation=full Formatting 'testfull.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=full # qemu-img info --object secret,data=testfull,id=sec0 --image-opts driver=file,filename=testfull.luks image: testfull.luks file format: file virtual size: 1.0G (1075810304 bytes) disk size: 256K # du -ah 256K ./testfull.luks 256K . 3.Create a luks image with falloc mode # qemu-img create -f luks --object secret,id=sec0,data=testfalloc -o key-secret=sec0 testfalloc.luks 1G -o preallocation=falloc Formatting 'testfalloc.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=falloc # qemu-img info --object secret,data=testfalloc,id=sec0 --image-opts driver=file,filename=testfalloc.luks image: testfalloc.luks file format: file virtual size: 1.0G (1075810304 bytes) disk size: 256K # du -ah 256K ./testfull.luks 256K ./testfalloc.luks 512K . 4. Create a luks image with off mode # qemu-img create -f luks --object secret,id=sec0,data=testoff -o key-secret=sec0 testoff.luks 1G -o preallocation=off Formatting 'testoff.luks', fmt=luks size=1073741824 key-secret=sec0 preallocation=off # qemu-img info --object secret,data=testoff,id=sec0 --image-opts driver=file,filename=testoff.luks image: testoff.luks file format: file virtual size: 1.0G (1075810304 bytes) disk size: 256K # du -ah 256K ./testfull.luks 256K ./testfalloc.luks 256K ./testoff.luks 768K . Additional info:
*** This bug has been marked as a duplicate of bug 1534951 ***