Unexpected power failure --> shutdown protection


I have a Xavier connected to a power source that might have a power failure.

Is there a way to protect the root file system, so the failure will not make it corrupted, and avoid
a case where the device will not load in the next boot ?

Read-Only root FS seems to be complex setup, if at all possible, on the Xavier - is there another recommended way by NVidia ?

Thanks for the help !

Actually, I don’t think rootfs issue would corrupt the system especially on xavier.
We have A/B redundancy mechanism to prevent boot failure but it does not support in rootfs.

Not an answer, but something to consider…

The ext4 filesystem itself has a journal. If anything any command has written to disk, but the journal has not recorded a commit to the actual disk, then the journal replays and you might lose the very most recent writes via the journal replay. The journal itself is of limited size, and it is possible that under a heavy write scenario that replay would be insufficient and the system would still demand a manual fsck.ext4 on the partition, at least for the rootfs. However, this would require heavy writing at the time (use your imagination for “heavy writing”).

I have seen some people attempting to use overlayfs, but unless you are good with custom initrd images, then probably this would be quite difficult (the initrd itself is an early boot image which is self contained and does minimal work before a chroot to the actual rootfs partition).