> On Feb 16, 2016, at 1:41 PM, William Hubbs <willi...@gentoo.org> wrote: > >> On Tue, Feb 16, 2016 at 01:22:13PM -0500, Rich Freeman wrote: >>> On Tue, Feb 16, 2016 at 1:05 PM, William Hubbs <willi...@gentoo.org> wrote: >>> >>> The reason it exists is very vague to me; I think it has something to do >>> with claims of data loss in the past. >> >> Is there some other event that will cause all filesystems to be >> remounted read-only or unmounted before shutdown? > > When localmount/netmount stop they try to unmount file systems they know > about, but they do not try to remount anything. > > >> You definitely will want to either unmount or remount readonly all >> filesystems prior to rebooting. I don't think the kernel guarantees >> that this will happen (I'd have to look at it). Just doing a sync >> before poweroff doesn't seem ideal - if nothing else it will leave >> filesystems marked as dirty and likely force fscks on the next boot >> (or at least it should - if it doesn't that is another opportunity for >> data loss). >> >> There are different ways of accomplishing this of course, but you >> really want to have everything read-only in the end. > > unmounting is easy enough; we already do that. > > What I'm trying to figure out is, what to do about re-mounting file > systems read-only. > > How does systemd do this? I didn't find an equivalent of the mount-ro > service there.
One idea proposed by systemd that is almost never used in production is to fall back to an initramfs environment to undo the boot process by umounting /. It would not surprise me if the normal case were hard coded to remount / as ro because you risk filesystem corruption otherwise. Journaling filesystems are fairly good at surviving that, but you are still taking a risk due to partial writes and anyone using ext2 would be taking a much bigger gamble. > > William