Summary: The VM's need to have virtioblk set to use discard=unmap in order for guest issuance of fstrim to pass through to the host backing file. This has the effect of creating a sparse backing file, since the holes don't take up space when compressing, it reduces image compression time, storage and download resources.
Details:
By mounting an oz created image on loop and using fstrim manually, I can demonstrate the large amount of garbage stuck in the raw file that should instead be holes.
This is about 1.75GiB of garbage needlessly compressed, stored, downloaded, and decompressed - times every nightly and person who downloads and uses the image. It's a huge waste. Similar problem exists for Fedora Cloud Base image.
First mount
892856 -rw-rw-r--. 1 chris chris 4294967296 Jul 21 14:45 Fedora-Cloud-Base-36-20220721.0.x86_64.raw
fstrim /boot (partition 2)
856796 -rw-rw-r--. 1 chris chris 4294967296 Jul 21 14:45 Fedora-Cloud-Base-36-20220721.0.x86_64.raw
fstrim / (partition 5)
429316 -rw-rw-r--. 1 chris chris 4294967296 Jul 21 14:46 Fedora-Cloud-Base-36-20220721.0.x86_64.raw
Alternative:
I'm told oz uses guestfs after installation to cutomize the image, so if it's easier to do the quiescing there, that's OK too.
[1]
The cache="unsafe" is consistent with other Fedora builder and compose systems, improving performance considerably.
[2]
I'm not certain driver type "raw-xz" supports discard=unmap, type "raw" definitely does.
Summary: The VM's need to have virtioblk set to use discard=unmap in order for guest issuance of fstrim to pass through to the host backing file. This has the effect of creating a sparse backing file, since the holes don't take up space when compressing, it reduces image compression time, storage and download resources.
Details:
This is about 1.75GiB of garbage needlessly compressed, stored, downloaded, and decompressed - times every nightly and person who downloads and uses the image. It's a huge waste. Similar problem exists for Fedora Cloud Base image.
I found this file in koji along with the logs and image files for the aaarch64 Workstation image above. https://kojipkgs.fedoraproject.org//packages/Fedora-Workstation/Rawhide/20220721.n.0/images/libvirt-raw-xz-aarch64.xml
Also attaching that xml file. libvirt-raw-xz-aarch64.xml.txt
It contains this section
Instead this needs:
Alternative: I'm told oz uses guestfs after installation to cutomize the image, so if it's easier to do the quiescing there, that's OK too.
[1] The cache="unsafe" is consistent with other Fedora builder and compose systems, improving performance considerably. [2] I'm not certain driver type "raw-xz" supports discard=unmap, type "raw" definitely does.