[systemd-devel] systemd-fsck-root semantics

Tom Gundersen teg at jklm.no
Thu Jul 3 05:23:57 PDT 2014


On Thu, Jul 3, 2014 at 2:14 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Thu, Jul 03, 2014 at 11:49:20AM +0200, Thomas Bächler wrote:
>> Am 02.07.2014 14:29, schrieb Daniel Drake:
>> > If I'm reading things right, actually the default behaviour is (when
>> > no hints are supplied in kernel cmdline) :
>> >  1. systemd runs fsck on root from initramfs
>> >  2. systemd mounts root fs ro
>> >  3. switch-root onto real system
>> >  4. systemd-fsck-root runs
>> >  5. systemd-remount-fs remounts / as rw
>> >
>> > Also just noticed another interesting thing -
>> > systemd-fsck-root.service is only loaded dynamically, when /etc/fstab
>> > has a non-zero passno for /. So maybe the idea is that anyone running
>> > a regular and modern dracut/systemd setup sets passno=0 for / in
>> > fstab, with the knowledge that fsck of / is done by the initramfs.
>>
>> Tom and me are thought this through a couple of months ago when I
>> started looking into using Arch's mkinitcpio with systemd. We submitted
>> a few changes to fsck handling back then.
>>
>> This is the setup we want to support (this is now the default in a new
>> Arch installation):
>> 1) fsck in initramfs
>> 2) initramfs mounts rw
>> 3) no re-fsck in the system
> This is what we want.
>
> We also want this to work:
> 1) fsck in the initramfs
> 2) initramfs mounts ro
> 3) no re-fsck or remount in the system

Hm, the only way this would get re-fscked in the system is if it is
explicitly configured to be in /etc/fstab... Shouldn't we just give
people what they ask for? Otherwise passno= for the rootfs would have
no effect at all in this setup (the rootfs is fscked unconditionally
in the initrd regardless of what /etc/fstab says (obviously)).

>> This is still supported, for legacy systems that have not been
>> reconfigured properly:
>> 1) no fsck in initramfs, or no initramfs
>> 2) initramfs or kernel mount ro
>> 3) fsck in the system
>> 4) remount rw in the system
>>
>>
>> This setup works, but is not optimal:
>> 1) fsck in initramfs
>> 2) initramfs mounts ro
>> 3) re-fsck in the system
>> 4) remount rw in the system
>> In this case, I always recommend mounting rw right away. However, you
>> can also configure your fstab to skip fsck - I don't see why anyone
>> would prefer this though.
>>
>> For your read-only case, you have two options:
>>
>> * Have an fstab entry for / with passno=0
>> * Don't list / in fstab
>>
>> I prefer the last option, since there is no benefit in adding / to fstab
>> - IMO, the correct mount options should always be given via the kernel
>> commandline to make remounting unnecessary.
>>
>> In my opinion, there is no need to change anything in systemd here,
>> since all the right configuration options are already there.
> You're right that everything *can* be configured to work properly.
> But if any fs was already checked in the initramfs, systemd should be
> always smart enough to avoid checking it again in the main system.
> I think that this is works for all filesystems except root. For root
> it breaks when the fs is mounted ro when transitioning to main system.
>
> Zbyszek
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list