implement a 'force check' flag, '-f'. I used the SunOS name, but the Digital

semantics.  now:
	(1) dirty file systems will always be checked; nothing new there.
	(2) if not '-f' clean file systems will _NEVER_ be checked,
		i.e. they won't be checked even if -p isn't specified.  This
		allows one to 'fsck -p ; fsck' to preen, then clean up
		anything that 'fsck -p' barfs on, without waiting for the
		clean file systems to be checked again.
	(3) if '-f' clean file systems will ALWAYS be checked.  This
		allows people to put 'fsck -fp' into /etc/rc on systems
		where they're leery of the FS clean flag state, need
		the extra reliability, and can afford time 'wasted'
		in checks.
The assumption made here is that if a file system is marked clean, it
_IS CLEAN_, really, and shouldn't be checked unless fsck is explicitly
told to (with -f).  This should be a valid assumption, but may not be in
the presence of file system bugs.  Documentation updated to note '-f'.
This commit is contained in:
cgd 1995-07-12 01:49:16 +00:00
parent be029faea0
commit 5f6a15bcbe
6 changed files with 48 additions and 16 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fsck.8,v 1.9 1995/03/18 14:55:43 cgd Exp $
.\" $NetBSD: fsck.8,v 1.10 1995/07/12 01:49:16 cgd Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -42,8 +42,10 @@
.Sh SYNOPSIS
.Nm fsck
.Fl p
.Op Fl f
.Op Fl m Ar mode
.Nm fsck
.Op Fl f
.Op Fl b Ar block#
.Op Fl c Ar level
.Op Fl l Ar maxparallel
@ -149,6 +151,15 @@ combined.
The following flags are interpreted by
.Nm fsck .
.Bl -tag -width indent
.It Fl f
Force checking of file systems. Normally, if a file system is cleanly
unmounted, the kernel will set a
.Dq clean flag
in the file system superblock, and
.Nm
will not check the file system. This option forces
.Nm
to check the file system, regardless of the state of the clean flag.
.It Fl b
Use the block specified immediately after the flag as
the super block for the filesystem. Block 32 is usually

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.16 1995/04/12 21:24:10 mycroft Exp $ */
/* $NetBSD: main.c,v 1.17 1995/07/12 01:49:21 cgd Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.16 1995/04/12 21:24:10 mycroft Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.17 1995/07/12 01:49:21 cgd Exp $";
#endif
#endif /* not lint */
@ -80,7 +80,7 @@ main(argc, argv)
sync();
skipclean = 1;
while ((ch = getopt(argc, argv, "dpnNyYb:c:l:m:")) != EOF) {
while ((ch = getopt(argc, argv, "dfpnNyYb:c:l:m:")) != EOF) {
switch (ch) {
case 'p':
preen++;
@ -101,6 +101,10 @@ main(argc, argv)
debug++;
break;
case 'f':
skipclean = 0;
break;
case 'l':
maxrun = argtoi('l', "number", optarg, 10);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: setup.c,v 1.21 1995/04/12 21:24:12 mycroft Exp $ */
/* $NetBSD: setup.c,v 1.22 1995/07/12 01:49:23 cgd Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
static char rcsid[] = "$NetBSD: setup.c,v 1.21 1995/04/12 21:24:12 mycroft Exp $";
static char rcsid[] = "$NetBSD: setup.c,v 1.22 1995/07/12 01:49:23 cgd Exp $";
#endif
#endif /* not lint */
@ -147,8 +147,9 @@ setup(dev)
if (debug)
printf("clean = %d\n", sblock.fs_clean);
if (sblock.fs_clean & FS_ISCLEAN) {
if (preen && doskipclean) {
pwarn("file system is clean; not checking\n");
if (doskipclean) {
pwarn("%sile system is clean; not checking\n",
preen ? "f" : "** F");
return (-1);
}
if (!preen)

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fsck_ffs.8,v 1.9 1995/03/18 14:55:43 cgd Exp $
.\" $NetBSD: fsck_ffs.8,v 1.10 1995/07/12 01:49:16 cgd Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -42,8 +42,10 @@
.Sh SYNOPSIS
.Nm fsck
.Fl p
.Op Fl f
.Op Fl m Ar mode
.Nm fsck
.Op Fl f
.Op Fl b Ar block#
.Op Fl c Ar level
.Op Fl l Ar maxparallel
@ -149,6 +151,15 @@ combined.
The following flags are interpreted by
.Nm fsck .
.Bl -tag -width indent
.It Fl f
Force checking of file systems. Normally, if a file system is cleanly
unmounted, the kernel will set a
.Dq clean flag
in the file system superblock, and
.Nm
will not check the file system. This option forces
.Nm
to check the file system, regardless of the state of the clean flag.
.It Fl b
Use the block specified immediately after the flag as
the super block for the filesystem. Block 32 is usually

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.16 1995/04/12 21:24:10 mycroft Exp $ */
/* $NetBSD: main.c,v 1.17 1995/07/12 01:49:21 cgd Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.16 1995/04/12 21:24:10 mycroft Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.17 1995/07/12 01:49:21 cgd Exp $";
#endif
#endif /* not lint */
@ -80,7 +80,7 @@ main(argc, argv)
sync();
skipclean = 1;
while ((ch = getopt(argc, argv, "dpnNyYb:c:l:m:")) != EOF) {
while ((ch = getopt(argc, argv, "dfpnNyYb:c:l:m:")) != EOF) {
switch (ch) {
case 'p':
preen++;
@ -101,6 +101,10 @@ main(argc, argv)
debug++;
break;
case 'f':
skipclean = 0;
break;
case 'l':
maxrun = argtoi('l', "number", optarg, 10);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: setup.c,v 1.21 1995/04/12 21:24:12 mycroft Exp $ */
/* $NetBSD: setup.c,v 1.22 1995/07/12 01:49:23 cgd Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
static char rcsid[] = "$NetBSD: setup.c,v 1.21 1995/04/12 21:24:12 mycroft Exp $";
static char rcsid[] = "$NetBSD: setup.c,v 1.22 1995/07/12 01:49:23 cgd Exp $";
#endif
#endif /* not lint */
@ -147,8 +147,9 @@ setup(dev)
if (debug)
printf("clean = %d\n", sblock.fs_clean);
if (sblock.fs_clean & FS_ISCLEAN) {
if (preen && doskipclean) {
pwarn("file system is clean; not checking\n");
if (doskipclean) {
pwarn("%sile system is clean; not checking\n",
preen ? "f" : "** F");
return (-1);
}
if (!preen)