[systemd-devel] systemd-fsck-root semantics

Daniel Drake drake at endlessm.com
Wed Jul 2 04:39:54 PDT 2014


Hi,

I'm trying to understand dracut/systemd fsck behaviour, in the context
of an ext4 filesystem root mounted read-only from dracut, remaining
read-only even when the system is fully booted (kiosk-style).

I see that systemd's fstab-generator rightly creates a mount unit for
/sysroot from the initramfs, and causes e2fsck to be run on it from
inside the dracut initramfs, before it is mounted. So far so good.


Then the system continues booting, switches root, and then
system-fsck-root.service starts from the root fs, and runs fsck on /
again. This is the bit I don't understand - we already checked from
the initramfs, why check again now?

There used to be a marker file in /run to let systemd know that the
initramfs already checked it, but that was removed in commit
956eaf2b8d6c9999024705ddadc7393bc707de02.

Also, systemd-fsck-root.service in itself seems a little questionable,
is it really safe in any context to run fsck on a mounted partition?
That could modify data structures which have already been cached in
memory in the kernel fs driver. In fact, e2fsck refuses to run on
partitions that are mounted, even ones that are ro.

Thanks for any clarification.
Daniel


More information about the systemd-devel mailing list