e2fsck auto runs on / upon startup after so many mounts
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want about this so that I can manually check and, when needed, do a fsck at shutdown
Just doing an fsck at shutdown sounds like it might be a timesaver, but most people would consider that inadequate: So, for example, if the power fails and you have a crash the filesystem could well be in an unknown state and this would be a situation in which you would want an fsck on start up.
So, to go down this route, I would want to take separate measures to ensure that if there had not been a clean shutdown that an fsck would be performed.
As to the issue of power failure, I looked the other day in the /etc/rc.d/rc.* files I forget which ones, perhaps rc.S and rc.6
In there I saw a detection/test to see if a file /etc/forcefsck exists or can be read. And, code comments very nearby therein spoke of "check to see if there had been a power failure"
Which prompts a new question: If I take control of the regular maintenance interval of when fsck gets run on / doing so should not affect as far as power failure happens because power failure caused/triggered fsck during bootup uses a seperate mechanism. Continued . . .
IOW, 1. regular interval maintenance fsck and 2. power failure triggered fsck -- each of these two uses its own and separate/independent checks or testing system so as to know when to run # 1 or # 2 Am I correct on this?
So that if I move #1 from startup so that it instead happens during shutdown -- then the #2 power failure forced fsck should still force an fsck during startup just like it always did. Correct?
Quote:
if the power fails and you have a crash the filesystem could well be in an unknown state and this would be a situation in which you would want an fsck on start up.
So, to go down this route, I would want to take separate measures to ensure that if there had not been a clean shutdown that an fsck would be performed.
Absolutely. I'm in agreement.
Quote:
I wrote:
manually check and, when needed, do a fsck at shutdown
Sorry, my mistake, I wasn't specific enough there. "when needed" there is far too general.
So, correction, in my original post I had meant to limit this fsck at shutdown idea to be: only a replacement or substitute for what currently (the #1) is an regular interval (after so many mounts) fsck of the ext3 file sys on "/"
(I find it a PITA when the dang thing just goes and runs fsck on / during a bootup). Simply, I wanted more control over this. This is a routine maintenance of which I see no reason that I cannot safely take control of it -- it is just a matter of my seeing to it that this maintenance task does get performed at reasonable and regular intervals.
Yippee! I discovered a way in which to do what I want:
For starters, ran the next command (note that /dev/sda3 is ext3 and mounts onto /)
root@AB60R:~# dumpe2fs /dev/sda3 | egrep '((ount count)|check|interval)'
dumpe2fs 1.39 (29-May-2006)
Mount count: 8
Maximum mount count: 24
Last checked: Wed Oct 24 22:02:27 2007
Check interval: 15552000 (6 months)
Next check after: Mon Apr 21 22:02:27 2008
root@AB60R:~#
Then, I exited KDE and X
I then logged onto tty1 as root and issued the command: telinit 1
then as root, did command: umount /
then as root, did command: e2fsck -f /dev/sda3
(in the above, must use the -f because we are manually forcing it to do a file sys check)
then as root, did command: reboot
then, once up, run our next friendly command again, noting the difference in the outputs (our mount count is now at 1)
root@AB60R:~# dumpe2fs /dev/sda3 | egrep '((ount count)|check|interval)'
dumpe2fs 1.39 (29-May-2006)
Mount count: 1
Maximum mount count: 24
Last checked: Sat Oct 27 16:43:15 2007
Check interval: 15552000 (6 months)
Next check after: Thu Apr 24 16:43:15 2008
root@AB60R:~#
So, I'll likely use tune2fs to bump the max mount count up to 30. And then when the mount count arrives at 25 I'll do my telinit 1 and the other commands of my manual method I described above.
In this way, I'll get my regularly scheduled e2fsck on / *but it will not happen at startup* because I'll do it at a mount count of 25
And, thusly, the mount count won't ever reach 30 which means the file sys will never run e2fsck on / at startup
I've not touched or altered the mechanism to force an e2fsck on / at startup in the event of a power failure. Therefore this mechanism still works the same, I still get a check after a power failure.
Thanks!!
I'll begin scripting some of this. I may use Perl for some of it. I'll have it auto check about once every 12 days or so (not too often but often enough to assure I catch it when the mount count hits 25). This is a desktop box that is booted about once a day on average. YMMV say for example with server that's not on and off much.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.