LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   why does an e2fsck restart itself? (https://www.linuxquestions.org/questions/linux-newbie-8/why-does-an-e2fsck-restart-itself-867654/)

anon091 03-10-2011 03:50 AM

why does an e2fsck restart itself?
 
Why does an e2fsck restart itself after a while, does it get to a certain number of errors than has to start over from the beginning? are there any tweaks or switches you can use to make it run more efficiently?

MensaWater 03-10-2011 03:07 PM

Do you mean "Why does it run on some boots and not others?"

The answer is that ext2 and ext3 filesystems have a parameter set that e2fsck will run automatically after a certain number of mounts. This can be adjusted with the tune2fs command. From the man page for that command:

Quote:

-c max-mount-counts
Adjust the number of mounts after which the filesystem will be
checked by e2fsck(8). If max-mount-counts is 0 or -1, the num-
ber of times the filesystem is mounted will be disregarded by
e2fsck(8) and the kernel.

Staggering the mount-counts at which filesystems are forcibly
checked will avoid all filesystems being checked at one time
when using journaled filesystems.

You should strongly consider the consequences of disabling
mount-count-dependent checking entirely. Bad disk drives,
cables, memory, and kernel bugs could all corrupt a filesystem
without marking the filesystem dirty or in error. If you are
using journaling on your filesystem, your filesystem will never
be marked dirty, so it will not normally be checked. A filesys-
tem error detected by the kernel will still force an fsck on the
next reboot, but it may already be too late to prevent data loss
at that point.
I don't know of anything that automatically runs e2fsck on systems other than that. (One could of course setup cron jobs to do that but I don't know of anyone that does.)

anon091 03-11-2011 01:38 AM

Hi, thanks for replying. That wasn't what I meant. I meant how sometimes when you run e2fsck, it will be running, fix a bunch of stuff, then it starts itself over from the beginning, and keeps doing that until it completes.

Thanks for the tune2fs info, I'm sure that will be handy if others read this post.

MensaWater 03-11-2011 08:37 AM

I've not seen e2fsck do what you mention on a single filesystem.

However, I'm wondering if what you're seeing is that e2fsck checks one filesystem then checks another then another until all are done? That is to say if when you reboot you're actually running e2fsck on multiple filesystems so the start/stop you are talking about may be for the different filesystems. If you do "df -h" on your system it will show you all the mounted filesystems.

anon091 03-11-2011 08:46 AM

I dont think I'm explaining this well. Let me try again. say you do a shutdown -rF now, your server reboots, as its coming up it e2fsck's each volume one by one. what typically happens for me (I'm lucky like that) is that when it e2fsck's one of my many huge volumes, it'll only get 25-50% done, then fails and says it needs to be run manually, then it drops you to a prompt to type the root password to get into the recovery console (can't remember the real name but that's essentially what it is, single user nothing mounted). At that point is when I run an e2fsck -y /dev/whatever. As its going through, it will get to a certain point (not sure what, but would like to know) then it restarts the e2fsck on that same volume automatically.

That's the scenario I was talking about. I guess it really can't run more efficiently than that, but was just wondering why it has to restart.


All times are GMT -5. The time now is 10:22 AM.