Xref: utzoo unix-pc.sources:350 comp.sys.att:7143 Path: utzoo!attcan!utgpu!watmath!att!icus!lenny From: lenny@icus.islp.ny.us (Lenny Tropiano) Newsgroups: unix-pc.sources,comp.sys.att Subject: REPOST: /etc/fsokay, /etc/rc, and a cleaner boot procedure for 3B1's Keywords: /etc/rc, /etc/fsck, booting, bugs, repost Message-ID: <934@icus.islp.ny.us> Date: 31 Jul 89 22:21:45 GMT Organization: ICUS Software Systems, Islip, New York Lines: 701 This is a repost of a previously posted item. Many people said they missed the first one, so I'm reposting it. Sorry for the extra traffic, but it's better than mailing many copies all over ... In any case it's small enough! -Lenny --- cut here --- --- cut here --- --- cut here --- --- cut here --- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh README <<'END_OF_README' XREAD THIS COMPLETELY AND PROCEED WITH CAUTION! X XHere's something I've wanted to do for quite some time. Basically there Xwas a discussion on the net about fsck trashing your filesystems, multiple Xreboots (when you don't think it is really necessary), etc, etc, etc... X XThis was a combination project ... Gil did most of the work on cleaning up Xthe "rc" script (with a few modifications to his by myself) and I wrote the X/etc/fsokay program (and associated other hooks into other system scripts). X XYou should feel confident about modifying system scripts, startup Xprocedures, answering fsck questions, and editting /etc/inittab before Xeven attempting this. (yes, you can edit /etc/inittab carefully). X XThis set of utilities will give you a couple of things, first it will give you Xmore reliability during boot-up and fsck'ing the filesystems. It will not Xfsck filesystems unless the system crashed (or was shutdown abnormally). It Xwill give you the control of answering the fsck questions (not using the -y Xswitch and possibly blowing away something that shouldn't be ...) You will Xbe able to see the fsck working, doing something, not just saying: X X "Stored files are now being checked ..." X -and- X "Some stored files were damaged. The damage will be repaired, X and the stored files will be checked again." X -and- X "Serious hard disk damage detected. Please refer to your Installation X Guide and install the system from the floppy disk set provided." X Xin a window ... The fsck process is done before the window driver is loaded Xand before any possible writes to the disk. The output to fsck isn't written to X/etc/.lastfsck (possibly causing more damage), but written to the /dev/console Xwhere you can see it! A possible disadvantage for some will be that the X"-y" option removed from fsck requires you to answer any possible disk errors Xduring fsck, therefore requiring operator intervention, and not able to Xdo automatic reboot if there are errors. Of course some will argue that Xfsck -y will fix 99% of the problems without any damage to your files, Xbut the 1% that it doesn't you'll be happy you had control over it. X XI wrote /etc/fsokay after trying to think about a work-around for no Xstate value within the filesystem structure (like what the /etc/fsstat program Xon the AT&T 3B2 does). Basically what I devised is that when you perform Xa shutdown (through the /etc/shutdown script), it does an "init s", the "s" Xrun-level is caught by the /etc/profile which is run automatically. I then Xafter the appropriate amount of "sync'ing" I truncate the /etc/mnttab X(ie. "> /etc/mnttab") On my system I call a script called "/etc/umountall" Xwhich umount's all the filesystems (other than / "root"). "/" cannot be Xumount'd, so I just *assume* everything is quiet, and truncate the file. X XHere is my /etc/mnttab, and why I have to umount all the other filesystems Xfirst ... X X/archives on /dev/fp013 read/write on Fri Jun 2 02:17:19 1989 X/netnews on /dev/fp012 read/write on Fri Jun 2 02:17:19 1989 X/tmp on /dev/fp011 read/write on Fri Jun 2 02:17:19 1989 X/ on /dev/fp002 read/write on Fri Jun 2 02:17:19 1989 X XMost of you won't need to worry about multiple partitions ... It's just Xthere commented out if you need it. X XWhen the system is booted, the rc script calls /etc/fsokay which checks Xthe contents of /etc/mnttab. Anything left in there will be assumed Xmounted when the system crashed or was shutdown abnormally, and will Xbe checked. If nothing is found in /etc/mnttab, then everything was OK, Xno filesystems need to be checked, and the system can boot without doing XANY fsck'ing. X XUsage: /etc/fsokay [-s] [-v] X X-s: will salvage the free list on any filesystem OTHER than "/" X See "-s" option of fsck(1M) X X-v: verbose option, will print out the message before calling fsck: X X : Last mounted on () at