[comp.unix.questions] fsck safe in run level 2?

belkin@teecs.UUCP (Hershel Belkin) (06/28/90)

Forgive me if this should be obvious, but I'd like to clear up
something...

I have often heard/read that fsck should not be run on a mounted
file system, and further, should never be run while in multi-user
mode.  While I understand the risks involved in attempting to
use fsck to correct errors while in multi-user mode, I have a 
problem understanding why there should be any harm in using fsck
to simply "look" at a mounted file system even while being used!

I can imagine that the fsck results could be incorrect (ie. may
perhaps indicate an error when in fact there is none) due to
disc activity.  But is there any possibility that fsck could
*cause* a problem (again, assuming "-n" responses)??

I'd appreciate some insights to this question.  (BTW, I have often
run fsck's in this mode, only switching to single user mode if
fsck shows any errors, so that I can confirm them as "real".  I have
never experienced any problems, but I'd like to know what others
feel about this).  Thanks!
-- 
+-----------------------------------------------+-------------------------+
| Hershel Belkin               hp9000/825(HP-UX)|      UUCP: teecs!belkin |
| Test Equipment Engineering Computing Services |     Phone: 416 246-2647 |
| Litton Systems Canada Limited       (Toronto) |       FAX: 416 246-5233 |
+-----------------------------------------------+-------------------------+

cpcahil@virtech.uucp (Conor P. Cahill) (07/02/90)

In article <970007@teecs.UUCP> belkin@teecs.UUCP (Hershel Belkin) writes:
>I have often heard/read that fsck should not be run on a mounted
>file system, and further, should never be run while in multi-user
>mode.  While I understand the risks involved in attempting to
>use fsck to correct errors while in multi-user mode, I have a 
>problem understanding why there should be any harm in using fsck
>to simply "look" at a mounted file system even while being used!

The only rule to remember is:

	FSCK should not be run on a mounted file system.

This gives you problems when the root file system is involved (especially
when you are on a unix system that does not provide the capability to
remount root following an fsck).

Single or Multi user mode has no effect on fsck.  If a file system is 
unmounted you could fsck it until the cows come home and have no problems
with your system (the execption being, of course, disk i/o performance).

>I can imagine that the fsck results could be incorrect (ie. may
>perhaps indicate an error when in fact there is none) due to
>disc activity.  But is there any possibility that fsck could
>*cause* a problem (again, assuming "-n" responses)??

If you run fsck in a "read only" mode, it will not cause any problems.  Like
you said, it will (almost positively) report false errors on your file system.

>I'd appreciate some insights to this question.  (BTW, I have often
>run fsck's in this mode, only switching to single user mode if
>fsck shows any errors, so that I can confirm them as "real".  I have
>never experienced any problems, but I'd like to know what others
>feel about this).  Thanks!

I would recommend against running fsck on a mounted file system even if 
you are now carefull to answer n to all the update questions.  Some time
in the future you will forget the n and cause file system damage that you
will regret.  If you want to check a file system, umount the file system
and fsck it.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

donlash@uncle.uucp (Donald Lashomb) (07/03/90)

In article <970007@teecs.UUCP> belkin@teecs.UUCP (Hershel Belkin) writes:
>
>I have often heard/read that fsck should not be run on a mounted
>file system, and further, should never be run while in multi-user
[...]
>disc activity.  But is there any possibility that fsck could
>*cause* a problem (again, assuming "-n" responses)??
[...]


I see no problem as long as you use "fsck -n".  Make sure you use the "-n"
option on the command line, don't depend on manually answering "No" to
fsck's questions to protect your filesystem from changes.  On my system,
if fsck is run without the "-n" option, it makes some changes to the
filesystem even if you answer "No" to all its questions ( clears empty
files, If memory serves ).  Using the "-n" command line option, fsck
announces "Read-only mode" upon startup.  I assume, it therefore will
not make any changes to the filesystem, no matter what.

BTW- I also run fsck on my root (mounted of course) filesystem regularly.
I do this this in single-user mode, however.  I do an immediate reboot
after running fsck.  In fact, fsck forces an immediate reboot under some
conditions (eg using "fsck -S" to cleanup the freelist).

-Don		donlash@uncle.UUCP

peter@ficc.ferranti.com (Peter da Silva) (07/06/90)

In article <1990Jul02.124310.7848@virtech.uucp> cpcahil@virtech.UUCP (Conor P. Cahill) writes:
> 	FSCK should not be run on a mounted file system.

Always proscribed, occasionally mandatory.

Once or twice in my life I've had to run fsck on a mounted non-root file
system. A quiescent one, to be sure. Sometimes you just can't unmount
a file system, and you can't risk a reboot just then...

Scarey, and you should reboot and re-fsck to rebuild the free list before
doing any real work on it... but it's possible.

If I never have to do it again, though, that'll still be too soon.
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.
<peter@ficc.ferranti.com>