make_ext4fs to generate filesystem
make_ext4fs to generate filesystem
Posted Oct 9, 2020 15:05 UTC (Fri) by jhhaller (guest, #56103)In reply to: make_ext4fs to generate filesystem by djwong
Parent article: The ABI status of filesystem formats
Setting the correct file ownership is another aspect requiring root access. The protofile addresses both of these issues,
as it overwrites the filesystem owner, permissions, and allows creating device files. I doubt mkfs was originally
concerned with CI systems, but creating filesystem images on a non-native host was likely an early concern.
Posted Oct 12, 2020 16:36 UTC (Mon)
by mebrown (subscriber, #7960)
[Link]
It uses an LD_PRELOAD library such that anything doing a mknod() libc call is saved to a database instead of invoking the underlying mknod() call, and instead just creates a regular placeholder file.
Then when you run mke2fs, similarly the LD_PRELOAD then hooks stat() such that mke2fs reading the placeholder file actually reads the details from the database instead of the filesystem.
Seems a little hacky at first, but seems to work well enough in practice.
make_ext4fs to generate filesystem