Should fsck honour "failok" in fstab as mount does?

Scott freebsd-lists-5 at thismonkey.com
Tue Apr 21 13:54:32 UTC 2020


On Tue, Apr 21, 2020 at 03:31:44PM +0200, Polytropon wrote:
> On Tue, 21 Apr 2020 17:13:20 +1000, Scott wrote:
> > mount ignores failed mount attempts when "failok" is specified as an option 
> > in /etc/fstab allowing the boot process to continue.
> > 
> > However, fsck does not, and I think it should.  It shouldn't mark an FS as 
> > clean, obviously, just not drop into single-user mode - let mount do that 
> > when it tries to mount an FS without the "failok" option.
> 
> In my opinion, this sounds wrong. If a filesystem is damaged,
> it's generally a bad idea to boot from it or mount it, as
> it often leads to inconsistencies, strange errors, and other
> things definitely not desired. Background fsck doesn't really

I agree entirely.  So on those filesystems you would not use `failok'.

> work. The file /etc/fstab is the filesystem table intended
> for use with mount; the fact that fsck uses it is just a nice
> side effect, but not its primary use. That's why the options
> field is intended for the mount command.

True, but that doesn't preclude fsck's use of any hints it may glean from 
/etc/fstab.
 
> The effect that the system drops into single-user mode is
> also intended. When fsck is invoked - upon filesystem error -

Sure, but the point of `failok' is to continue booting even if the so 
optioned filesystem cannot mount for whatever reason.  Unfortunately fsck 
makes no use of this indication and prevents booting.  These two commands, 
fsck and mount need to work in tandem.

> Keep in mind this is not always intended! That's why
> there is the single user mode, to allow a human decision.

Yes, again you would not specify `failok' if you wanted to stop booting for 
human intervention.
> 
> If you don't want fsck to stumble upon a damaged filesystem,
> do not include it in /etc/fstab. You can still use a custom
> rc.d-style script or an entry in /etc/rc.local if you wish
> to "maybe mount" non-vital or optional filesystems later on.
 
Sure, but why would you want to do it that way?  The same could be said when 
the `failok' option was not available to mount.

Consider the situation where a device specified in /etc/fstab is not present 
during boot, say a USB stick.  You've added the `failok' option to its 
/etc/fstab entry, declaring that if you can't mount the device, ignore the 
error and continue. fsck will still drop into single user mode.  Does that 
make sense?

Thanks for your response,
Scott


More information about the freebsd-questions mailing list