Reproducible XFS Filesystems Builds for VMs

Jelle van der Waa jelle at vdwaa.nl
Sat Apr 12 12:37:42 UTC 2025


On 4/11/25 16:47, Luca DiMaio via rb-general wrote:
> Hello list,
> 
> I am a Software Engineer at Chainguard working on reproducible builds
> for VMs, and we're happy to say that we've successfully implemented
> reproducible disk images with EFI+EXT4 partitions using the following
> methods:
> 
> But this all becomes aleatory when we try to populate the filesystem,
> by using mount + untar the source tar.gz
> 
> Right now I've opened a thread on the XFS Mailing list, to ask about how to
> proceed about this, and if they're interested in making XFS
> reproducible-friendly
> Here: https://lore.kernel.org/linux-xfs/CAKBQhKVi6FWNWJH2PWUA4Ue=aSrvVcR_r2aJOUh45Nd0YdnxVA@mail.gmail.com/T/#u
> 
> 
> I'd like to hear your inputs on the approach here, or also showing
> interest in the
> XFS thread if anyone else is interested in this.
In the ideal case I would say mkfs.xfs grows a mode where it can 
construct a filesystem from a given directory like ext4. When I was 
looking into making reproducible images I looked at what systemd-repart 
did as they want to be able to make rootless images.

For XFS they seem to use protofiles to directly create a filesystem with 
data on it. [1] [2] [3]
So maybe that helps? A common source of reproducibility issues with 
mounting the filesystem which creates a bunch of irreproducible 
meta-data to be created which is hard to get rid of.

Related to reproducible images I have found it is possible to make an 
reproducible f2fs image but not a btrfs image, although it does support 
a `--rootdir` option to populate the filesystem.

[1] https://man.archlinux.org/man/mkfs.xfs.8.en#p
[2] 
https://man.archlinux.org/man/core/systemd/repart.d.5.en#%5BPARTITION%5D_SECTION_OPTIONS
[3] 
https://github.com/systemd/systemd/blob/9f091f098afeafd44a1ba1615d83cd845990518f/src/shared/mkfs-util.c#L169

Greetings,

Jelle


More information about the rb-general mailing list