Thanks Christoph for the prototype pointer, I've experimented with it and indeed we get to create a reproducible XFS Filesystem as such (still using that LD_PRELOAD trick): ``` ~$ tar --sort=name --warning=no-timestamp --xattrs --xattrs-include='*' -xpf rootfs.tar.gz --numeric-owner -C rootfs/ ~$ xfs_protofile rootfs > rootfs.protofile ~$ export LD_PRELOAD="./deterministic_rng.so /usr/lib/faketime/libfaketime.so.1" ~$ mkfs.xfs \ -b size=4096 \ -d agcount=4 \ -d noalign \ -i attr=2 \ -i projid32bit=1 \ -i size=512 \ -l size=67108864 \ -l su=4096 \ -l version=2 \ -m crc=1 \ -m finobt=1 \ -m uuid=$ROOTFS_UUID \ -n size=16384 \ -p rootfs.protofile \ -n version=2 disk1.img ~$ mkfs.xfs \ -b size=4096 \ -d agcount=4 \ -d noalign \ -i attr=2 \ -i projid32bit=1 \ -i size=512 \ -l size=67108864 \ -l su=4096 \ -l version=2 \ -m crc=1 \ -m finobt=1 \ -m uuid=$ROOTFS_UUID \ -n size=16384 \ -p rootfs.protofile \ -n version=2 disk2.img ~$ md5sum disk* dd06b8c8fe79e979d961291a4f78b72e disk1.img dd06b8c8fe79e979d961291a4f78b72e disk2.img ``` This is a huge step ahead, but we still are facing some missing features/bugs: - we lose the extended attributes of the files - we lose the original timestamps of files and directories I see that the prototype specification does not include anything about those, are there plans to support xattrs and timestamps? Thanks a lot for the help L. On Mon, Apr 14, 2025 at 7:39 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > Hi Luca, > > On Fri, Apr 11, 2025 at 04:38:10PM +0200, Luca DiMaio wrote: > > EXT4 addresses this issue with the -d flag, which allows populating > > from an archive or directory without mounting. > > Is there similar functionality available for XFS, or is there interest > > in developing a method for generating reproducible XFS root > > filesystems? > > > > I'm asking this because we'd be interested in using XFS as a filesystem for the > > final product. > > mkfs.xfs supports the -p protofile option which allows populating the > file system with existing files and directories at mkfs time. Can you > that and reports if it helps? If not we might be able to look into > fixing issues with note. Note that the protofile is a little arcane > so read the documentation carefully. >