Red Hat Bugzilla – Bug 460763
FSCK of large discs on startup can take AGES
Last modified: 2014-03-16 23:15:39 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
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
echo "$fsystem clean" >> $logfile
/sbin/tune2fs -C 1 $fsystem # Reset mount count flag
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!
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.