Bug 460763 - FSCK of large discs on startup can take AGES
FSCK of large discs on startup can take AGES
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-08-31 04:58 EDT by simd
Modified: 2014-03-16 23:15 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-08-31 16:13:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description simd 2008-08-31 04:58:31 EDT
This is an enhancement request around the 30 sec startup topic. It may apply to init scripts or plymouth.

With terabyte disc drives cheaply available, the time to do an fsck (when the partition counter runs out) can be totally unacceptable. Tens of minutes. This can be frustrating in the extreme, especially when you have something urgent to do.

A solution, which I found on the web, and seems to run very well, is to add an fsck check to the shutdown process (not to reboot though!). 

This activates a full fsck check at a count shorter than the count for the partition for fsck'ing. 

If it runs without error it resets the counter in the partition to 1. If it fails, it causes an fsck to be run at bootup, so I can deal with it when I'm present (i.e. its a real problem).

The point is, I don't care how long my machine takes to shutdown (I go to bed for example). But I do care about startup time. 

The shutdown process gives a useful window for various maintanance scripts. I also, for example, now take a backup of my home directory and e-mail at this point, after home is unmounted. 

I therefore don't agree with the comment I read on the fedora wiki, that on shutdown the machine should simply stop asap on shutdown. (https://fedoraproject.org/wiki/Talk:Features/BetterStartup : Ray Strode)

Example of what I did (ok the script can probably be improved):

for fsystem in $file_systems; do
    device=$(/sbin/findfs $fsystem)
    mountcount=$(/sbin/dumpe2fs -h $device | grep  "Mount count:" | cut --delimiter=":" --field=2 | tr -d " ")
    if [[ $mountcount -gt $threshold ]]; then
         if [[ ("$?" != "0") ]]; then
             echo "Error found on $fsystem: Forcing check on next boot"  >> $logfile
             touch /forcefsck
             echo "$fsystem clean"  >> $logfile
             /sbin/tune2fs -C 1 $fsystem     # Reset mount count flag
Comment 1 simd 2008-08-31 05:09:05 EDT
Note: (addendum):
Thinking about it though, a laptop user probably does care how long the machine takes to shutdown (need to catch a plane etc). Maybe it needs to be configuable!
Comment 2 Jeremy Katz 2008-08-31 16:13:03 EDT
We default new (ext3) filesystems to not require a check unless there's actually an error with tune2fs -c0 -i0 on filesystem creation. 

Thus, you shouldn't be getting a fsck unless there's an actual error to be had.

Note You need to log in before you can comment on or make changes to this bug.