Skip to content

Commit dd9341d

Browse files
committed
chore(orch): split mkfs.ext4 feature flags into individually commentable slice
Replace the single comma-separated string literal for mkfs.ext4 -O with strings.Join over a slice, so each ext4 feature flag can be commented individually. Flags are sorted alphabetically within the main group, with ^orphan_file separated at the end as a guest-compatibility workaround. Original comments describing the feature set rationale (tar2ext4 matching, kept defaults, orphan_file compat) are preserved in place. No functional change - produces the identical argument string at runtime. Addresses review feedback from #2082. Link: #2082 (comment)
1 parent 5adcb7a commit dd9341d

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

  • packages/orchestrator/internal/template/build/core/filesystem

packages/orchestrator/internal/template/build/core/filesystem/ext4.go

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,28 @@ func Make(ctx context.Context, rootfsPath string, sizeMb int64, blockSize int64)
4141

4242
cmd := exec.CommandContext(ctx,
4343
"mkfs.ext4",
44-
// Matches the final ext4 features used by tar2ext4 tool
45-
// But enables resize_inode, sparse_super (default, required for resize_inode), has_journal (default), metadata_csum (default).
46-
// orphan_file is disabled (added as default in e2fsprogs >= 1.47.0) to ensure guest e2fsprogs tools
47-
// (tune2fs, resize2fs, e2fsck) from older images (e.g. Ubuntu 22.04, Debian 11) can write to
48-
// the filesystem. Without this, any write operation from the guest fails with "unsupported
49-
// read-only feature(s)" when the host e2fsprogs is newer than the guest's.
50-
// See https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0
51-
"-O", `^dir_index,^64bit,^dir_nlink,^orphan_file,ext_attr,sparse_super2,filetype,extent,flex_bg,large_file,huge_file,extra_isize`,
44+
"-O", strings.Join([]string{
45+
// Matches the final ext4 features used by tar2ext4 tool.
46+
// But enables resize_inode, sparse_super (required for resize_inode),
47+
// has_journal, and metadata_csum are kept as defaults.
48+
"^64bit",
49+
"^dir_index",
50+
"^dir_nlink",
51+
"ext_attr",
52+
"extent",
53+
"extra_isize",
54+
"filetype",
55+
"flex_bg",
56+
"huge_file",
57+
"large_file",
58+
"sparse_super2",
59+
60+
// Disabled for compatibility with older guest e2fsprogs (Ubuntu 22.04, Debian 11).
61+
// orphan_file was added as default in e2fsprogs >= 1.47.0; without disabling it,
62+
// guest tools fail with "unsupported read-only feature(s)".
63+
// See https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0
64+
"^orphan_file",
65+
}, ","),
5266
"-b", strconv.FormatInt(blockSize, 10),
5367
"-m", strconv.FormatInt(reservedBlocksPercentage, 10),
5468
"-i", strconv.FormatInt(inodesRatio, 10),

0 commit comments

Comments
 (0)