Skip to content

feat(ext4): create jbd2-journaled images - #13

Merged
lstocchi merged 1 commit into
redhat-developer:mainfrom
lstocchi:journal
Nov 20, 2026
Merged

lstocchi merged 1 commit into
redhat-developer:mainfrom
lstocchi:journal

Conversation

@lstocchi

@lstocchi lstocchi commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Every image of at least 8 MiB now carries a jbd2 journal, as mke2fs writes one, so the guest kernel recovers a crashed VM by replaying the journal on mount instead of needing e2fsprogs in the guest. The journal is created once by the constructors and never touched again: the builder never replays or checkpoints; the kernel is the only writer after create.

The on-disk form mirrors mke2fs: inode 8, mode 0600, extent-mapped contiguous blocks sized by ext2fs_default_journal_size (4 MiB under 128 MiB, a growing ladder above; verified against mke2fs at 64 MiB and 256 MiB), a v2 journal superblock with big-endian fields and no checksum features, s_journal_inum = 8, and the s_jnl_blocks[17] backup with s_jnl_backup_type set. reserve_inodes now skips already- allocated low inodes so inode 8 is not double-counted. The sizing estimate adds the journal so recommended images have room for tree plus journal.

this resolves #5

Every image of at least 8 MiB now carries a jbd2 journal, as mke2fs
writes one, so the guest kernel recovers a crashed VM by replaying the
journal on mount instead of needing e2fsprogs in the guest. The
journal is created once by the constructors and never touched again:
the builder never replays or checkpoints; the kernel is the only
writer after create.

The on-disk form mirrors mke2fs: inode 8, mode 0600, extent-mapped
contiguous blocks sized by ext2fs_default_journal_size (4 MiB under
128 MiB, a growing ladder above; verified against mke2fs at 64 MiB and
256 MiB), a v2 journal superblock with big-endian fields and no
checksum features, s_journal_inum = 8, and the s_jnl_blocks[17]
backup with s_jnl_backup_type set. reserve_inodes now skips already-
allocated low inodes so inode 8 is not double-counted. The sizing
estimate adds the journal so recommended images have room for tree plus
journal.

Assisted-by: Claude Code: GLM 5.3
Assisted-by: Claude Code: Opus 5.5
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
@lstocchi
lstocchi merged commit 59b5183 into redhat-developer:main Nov 20, 2026
4 checks passed
@lstocchi
lstocchi deleted the journal branch November 20, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Journaling feature

1 participant