Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,28 @@ func Make(ctx context.Context, rootfsPath string, sizeMb int64, blockSize int64)

cmd := exec.CommandContext(ctx,
"mkfs.ext4",
// Matches the final ext4 features used by tar2ext4 tool
// But enables resize_inode, sparse_super (default, required for resize_inode), has_journal (default), metadata_csum (default).
// orphan_file is disabled (added as default in e2fsprogs >= 1.47.0) to ensure guest e2fsprogs tools
// (tune2fs, resize2fs, e2fsck) from older images (e.g. Ubuntu 22.04, Debian 11) can write to
// the filesystem. Without this, any write operation from the guest fails with "unsupported
// read-only feature(s)" when the host e2fsprogs is newer than the guest's.
// See https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0
"-O", `^dir_index,^64bit,^dir_nlink,^orphan_file,ext_attr,sparse_super2,filetype,extent,flex_bg,large_file,huge_file,extra_isize`,
"-O", strings.Join([]string{
// Matches the final ext4 features used by tar2ext4 tool.
// But enables resize_inode, sparse_super (required for resize_inode),
// has_journal, and metadata_csum are kept as defaults.
"^64bit",
"^dir_index",
"^dir_nlink",
"ext_attr",
"extent",
"extra_isize",
"filetype",
"flex_bg",
"huge_file",
"large_file",
"sparse_super2",

// Disabled for compatibility with older guest e2fsprogs (Ubuntu 22.04, Debian 11).
// orphan_file was added as default in e2fsprogs >= 1.47.0; without disabling it,
// guest tools fail with "unsupported read-only feature(s)".
// See https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0
"^orphan_file",
}, ","),
"-b", strconv.FormatInt(blockSize, 10),
"-m", strconv.FormatInt(reservedBlocksPercentage, 10),
"-i", strconv.FormatInt(inodesRatio, 10),
Expand Down
Loading