From owner-freebsd-questions@freebsd.org Tue Apr 21 13:32:05 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78CBB2CDE29 for ; Tue, 21 Apr 2020 13:32:05 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4964H74y80z4KdY for ; Tue, 21 Apr 2020 13:32:03 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.27.149]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPA (Nemesis) id 1M27Bp-1jOy7u2uHR-002ZQa; Tue, 21 Apr 2020 15:31:47 +0200 Date: Tue, 21 Apr 2020 15:31:44 +0200 From: Polytropon To: Scott Cc: freebsd-questions@freebsd.org Subject: Re: Should fsck honour "failok" in fstab as mount does? Message-Id: <20200421153144.d45a889b.freebsd@edvax.de> In-Reply-To: <20200421071319.GA98163@thismonkey.com> References: <20200421071319.GA98163@thismonkey.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:/1/kdTYEM36BYMdG4TPFsoSq9lkSx7VN/FK6Zw5byJSP+XYOvBx 3qJQecPAX5oSLqUrQ14AxWnTdV/Oa6+ai7v0gz+W7tzgbNbfhjCGiL6ASCnCFgv5nhRiiYu nOGoqkpS3J4+HwiucEnzXcrVGySmbHRR/yCeE2BQNjjech03w66Wc84OGtAMBJ3n7tWpqq/ 70k5qD3o64cDwzfGfXj1Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:fb4CKuKLlS0=:J75m1LwBbLfPHXYLwbiM7k WWFBqcY/WfVbV4ihb2EYmA+digg5z3liGyOLetFyuOe9eCaKTadggnXQ1Tw/53lhlzXaN1hJB Euv0mU1vYQAcLaW2CpR6mQMCiz5D4wjI7MgEI/nkZwwYbXlHHeKnakFtN90Mr8gH8nAGJlSWO bvoEgz2eiIUxO9/lR6OztKivpVzCJzh90IHA3n790z3gDy3bvazollTRuin3RTLdmrelpH3zh yRB4Q2glzbnEz+xHC6kMCB/Wm1BeqOuPTSD2xFlQui+76v54wtrf8KuqZYxzVYGVO/LZ52lqk omN93WdeC78QuOvLqnfqPRlqoseV5QF0M30HVaVBpfOl0v5JZJS2uyS99jQJgXSR8JEcELR+C rBvupcQKhOMXN1/3ovIbGP1nMZ6S4gy+AtdTNNPeYo0Kde66rFdipD2wZhdK/Mnvu3Z88lhLf P6bJ2LLSszbXHq912Y3ii5yuBLlqzjQAC0NpfyFU7E0/DpydGg4d/QJ2LWqQ/gHUTq+iqDKEO sbIK1IkQ8ChXCgcdgGni00ADyjyp+LVITYT50eMNpHdHpl8vM4Bv1gE9wtEMUBfxXcEhapBVA kuEVF1Uzzn1fK4If85enwVx/zhPtAM48dXDJHTPr6NuqMNP+tta+LqSiCQjjNduRGsyhtd9HY C1k6uszkl5ghRBZ4MaKxwMQO+CokWgncAruqQVBxqFRsbcnuwe48P4faIgm9sSGR11E+IqbH7 LwF9VQASzkboBkPNUFx2WeLHQjA/n60UzwMrEO5Ex+8mxehYdiX/2TlWuPbSnSBKBDIwdLhb3 g0hjwceI7pUOPMdjR27mlmkErU0K+GkAauQNb4fhblThu4fZAFQB4pTQU5QrMyPsAlQxyRX X-Rspamd-Queue-Id: 4964H74y80z4KdY X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 212.227.126.133) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [5.62 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[149.27.222.94.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.92)[0.917,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000,0]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[133.126.227.212.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.30)[ip: (0.64), ipnet: 212.227.0.0/16(-1.20), asn: 8560(2.08), country: DE(-0.02)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2020 13:32:05 -0000 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 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. >From "man 5 fstab": The fourth field, (fs_mntops), describes the mount options associated with the file system. This matches the behaviour intended with the "failok" option. It is intended for the mount program. Again from "man 5 fstab": If the option ``failok'' is specified, the system will ignore any error which happens during the mount of that filesystem, which would otherwise cause the system to drop into single user mode. This option is imple- mented by the mount(8) command and will not be passed to the kernel. Nothing here is related to fsck. The effect that the system drops into single-user mode is also intended. When fsck is invoked - upon filesystem error - it will automatically repair minor defects, and afterwards the system will continue booting. In case of major defects the system operator is expected to make decisions. It _might_ be possible that he does not want fsck to attempt any further repair, and instead relapse to other tools (data recovery, or restore from backup right away). Certain aspects of this behaviour can be controlled with the followint variables in /etc/rc.conf, for example: background_fsck="NO" # never! fsck_y_enable="YES" # always say "yes" fsck_y_flags="-f" # force fsck This will always force fsck to perform a full check and repair, and answer "yes" whenever needed, in case the initial preen ("minor defects repair mode") fails. The equivalent is: # fsck -y -f Keep in mind this is not always intended! That's why there is the single user mode, to allow a human decision. 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. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...