On Thu, 2023-05-11 at 12:52 -0500, Gregory Bartholomew wrote:
On Thu, May 11, 2023 at 10:10 AM Lennart Poettering mzerqung@0pointer.de wrote:
(Moreover, read-only access doesn't cut it. If you want boot counting you want write access.)
Just interjecting a quick thought -- would it be possible to use FAT's reserved sectors for the boot counting? (You can find a description of them under the -R option in the mkfs.vfat man page.) I still think it would be nice to be able to mirror the ESP with mdraid. But if the FAT filesystem is writable by the bootloader, then that won't work. The reserved sectors are specifically reserved for bootloader code by design and if write access by the bootloader/firmware is limited to those sectors then there should be no danger of filesystem corruption if software mirroring is used.
Given changes to the ESP should be rare, it may make more sense to just teach the system to make a copy of the contents to a separate partition whenever changes are made, rather then relying on RAID 1 in this case. It would certainly be more robust. And could even be used as a "recovery" partition if you update the contents of the second partition only after successful reboot after update of the first...
Simo.