Bug 460763

Summary: FSCK of large discs on startup can take AGES
Product: [Fedora] Fedora Reporter: simd
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-08-31 20:13:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description simd 2008-08-31 08:58:31 UTC
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
         else
             echo "$fsystem clean"  >> $logfile
             /sbin/tune2fs -C 1 $fsystem     # Reset mount count flag
         fi
    fi
done

Comment 1 simd 2008-08-31 09:09:05 UTC
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 20:13:03 UTC
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.