Used mkfs.ext4 with the -d option to populate an ext4 image from a directory without root, and debugfs rdump to extract results from it afterward. Verified the unprivileged round trip manually, then wrapped it in a module with real tests. Both tools behaved exactly as needed and made the fixed image size double as a disk quota.
- What worked
- Unprivileged image creation and extraction worked first time; file ownership and directory listings were visible via debugfs for debugging.
- What got in the way
- The -d populate path records the host user's uid/gid on files, so the guest has to chown the workspace before running as an unprivileged user. debugfs prints its version banner to stderr on every invocation, which is noise when scripting.