mirror of
https://github.com/home-assistant/operating-system.git
synced 2026-05-08 17:49:46 +01:00
56e0d941d0
Use sparse files instead of files written full of zeros. This speeds up the image generation process significantly. It also makes sure that virtual disk image formats are minimal in size. Note: qemu-img automatically generates sparse files when detecting a block full of zeros. But this is applied on the write side, after image convertion: The disk image format itself still thinks the whole image is allocated, leading to larger image than necessary. Also some output format seem to regonize chunks of zero and create sparse files themself. With this change, the raw source image file is a sparse file. This is regocnized by qemu-img at read time (see block/file-posix.c), and leads to "native" sparse files in the output format. Some numbers - qcow2 1.8G -> 862M (same on-disk size) - vdi 15G -> 888M (same on-disk size) - vhdx 30G -> 1.1G (918M -> 861M on-disk size) - vmdk 1.8G -> 866M (about the same on-disk size) Obviously this also affects the compressed size. But because there are still lots of zeros, the difference in compressed size is not that big.