LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-27-2007, 01:06 AM   #1
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 50
e2fsck auto runs on / upon startup after so many mounts


e2fsck auto runs on / upon startup after so many mounts

how/where does the sys log that "so many mounts" have occurred?

I want about this so that I can manually check and, when needed, do a fsck at shutdown

I know that tune2fs can change how many mounts between file sys checks.
 
Old 10-27-2007, 01:45 AM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
The filesystem itself records the number of mounts among other thing. This why you need tune2fs to change the default behaviour.
 
Old 10-27-2007, 03:53 AM   #3
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,784

Rep: Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460
Quote:
Originally Posted by acummings View Post
e2fsck auto runs on / upon startup after so many mounts

how/where does the sys log that "so many mounts" have occurred?
For example, for /dev/sda1, try 'dumpe2fs /dev/sda1' and look for Mount count, Maximum mount count, Last checked, Check interval.
 
Old 10-27-2007, 06:12 AM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by acummings View Post
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.
 
Old 10-27-2007, 01:28 PM   #5
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Original Poster
Rep: Reputation: 50
Thanks much for all replies so far.

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.

--
Alan
 
Old 10-27-2007, 08:19 PM   #6
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Original Poster
Rep: Reputation: 50
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.

--
Alan.
 
Old 10-28-2007, 01:37 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
You could put a block of code in rc.0/rc.6 that would perform the check for you. BTW, you don't have to unmount the / -you should use remount:

/sbin/mount -n -o remount,ro /
 
Old 07-08-2008, 09:07 AM   #8
mjalalynia
Member
 
Registered: Jul 2008
Posts: 48

Rep: Reputation: 15
Unhappy next check after <none>

Quote:
Originally Posted by Petri Kaukasoina View Post
For example, for /dev/sda1, try 'dumpe2fs /dev/sda1' and look for Mount count, Maximum mount count, Last checked, Check interval.
hello
why do i see "next check after (<none>) in all of my devices(root ,boot,..)?
 
Old 04-04-2012, 06:30 PM   #9
hokie1999
Member
 
Registered: Feb 2011
Posts: 52

Rep: Reputation: 0
Disregard
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
e2fsck after 21 mounts really necessary? sadarax Linux - General 3 04-11-2006 09:17 PM
e2fsck startup problem abattoir Mandriva 2 09-25-2005 09:00 AM
browse option for auto.master for yp mounts azhiker Linux - Networking 2 04-16-2005 11:13 AM
Cd mounts auto ch4s3r Linux - Software 1 02-26-2004 06:35 PM
schedule 'e2fsck' to run on startup, possible? BxBoy Linux - General 1 02-18-2004 12:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration