In an embedded system, we are using 2 partitions (P1 and P2) for the redundant storage of data.
By default, both partitions are mounted read-only. When data need to be written, P1 is to be remounted read-write, data written, then P1 is remounted read-only. Then the same does for P2.
As a power-off may occur anytime, this mechanism is supposed to minimize possible data corruption. There are also security issues involved.
Indeed, if, upon bootup, one of the partition "last mount state" is read/write, we can infer that a power cutoff occur during the write sequence of that partition and that it is dirty. It can then be safely overwritten with the other partition data.
Is there a way to retrieve this "last mount status" given that the main filesystem will be a mixture of read-only and volatile items ? Maybe some "dirty" bit ?
Note that I have read Is it dangerous to remount a partition rw/ro frequently? and What filesystem offers best protection for securing data against corruption due to power loss? which deal with some of the issues involved here.