Switching ext4 rootfs as data=journal mode


L4T 35.1
XavierNX based CustomBoard

I’ m working on XavierNX based custom board with NVMeSSD Boot.
Rootfs mounts default ext4 in ordered mode.

# mount
/dev/nvme0n1p1 on / type ext4 (rw,relatime)

Is it possible to run the rootfs in ext4 data=journal mode
to protect data in the event of an unexpected power outage?

The has_journal flag is already set in the partition information.

# tune2fs -l /dev/nvme0n1p1
tune2fs 1.45.5 (07-Jan-2020)
Filesystem volume name:   <none>
Last mounted on:          /mnt
Filesystem UUID:          6f5b0fb2-e44f-49ab-93c1-c578248539db
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal

We added “rootflags=data=journal” in kenrel parameter, but mount state of rootfs did not change.

# cat /proc/cmdline
root=PARTUUID=443cb74b-ccb8-47e4-9d47-10b91a65b952 rw rootwait rootfstype=ext4 rootflags=data=journal console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

# mount | head
/dev/nvme0n1p1 on / type ext4 (rw,relatime)

How do I switch ext4 to data=journal mode in XavierNX R35.1 environment? Thank you!

I don’t know if I can answer, but is the SSD’s partition in “/etc/fstab”? During a mount the fourth field specifies options. If your ext4 partition has a journal available (and it looks like it does), then the async option in field four probably does what you want. The “defaults” parameter is how most people would set permissions, and this is equivalent to:
(field four is a comma-delimited list of options)

Note that a journal is not always what people think it is. One reference:

The short answer is that the journal will cause a non-fatal loss of data which has begun write, but which has not completely flushed to persistent memory. If the journal size is exceeded, then the entire filesystem can be lost. In all cases though you will have some loss of data if there is a write started, but not yet complete when power is lost. Synchronous mode is the only guaranteed method of not corrupting and not losing data, but performance will suffer horribly, and any solid state device will fail far sooner than normal.

So far as I know the default is to mount with the use of journal if the kernel supports the journal feature and if the filesystem supports the journal, except when told to not use the journal. I can’t guarantee that, but I guess a question is what prompts this question? Was it loss of data? Was it complete corruption and loss of the partition? Or is this just research on the topic?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.