[CentOS] How to stagger fsck executions

Warren Young wyml at etr-usa.com
Thu Apr 23 03:46:29 UTC 2015


On Apr 22, 2015, at 11:56 AM, Hugh E Cruickshank <hugh at forsoft.com> wrote:
> 
> I have done some "what if" testing.

Using which tool?  My simulator, or something you cooked up yourself?  If the latter, would you care to share?

I’ve updated mine to break out the stats for 3+ volumes instead of just reporting all multi-volume fscks together:

    https://gist.github.com/wyoung/7c94967bb635de48d058

Then I rewrote that in C++, since these 8-volume simulations were literally going to take days with the Perl version:

    https://gist.github.com/wyoung/966383b4efbb63aafc71

(The Perl version is about 1/5 the speed of the C++ one.  This actually isn’t all that bad, considering that it’s an interpreted dynamically-typed language going up against a statically-typed native-code compiled language.)

> Using the prime numbers 7, 11, 13, 17, 19, 23, 29 and 31 the is a
> maximum of 7 incidents per year of 2 fscks per week and none for 3 or
> more.

This is why I pointed out that you only need *relatively* prime numbers: so that if you decide the largest max-mount-count can’t be over 31, you don’t have to go clear down to 7 in order to find the last prime for 8 volumes.

Using relatively-prime numbers, you can skew the set upwards quite a bit without increasing the largest value.  The most efficient set I’ve been able to come up with is:

    17, 19, 23, 25, 27, 28, 29, 31

The three composite values (25, 27, and 28) do not share any common factors: 25 uses 5 twice, 27 uses 3 thrice, and 28 uses 7 plus twice 2.

My newer simulators give these results for the chances of a multi-volume fsck with your prime set:

    period:   ~6.7 billion
    2-volume: 8.12%
    3-volume: 1.08%
    4-volume: 0.09%
    >5:       < 0.01% chance
    total:    9.3%

My relatively prime improved set gives these results because the set’s median is higher while keeping the same maximum, while also avoiding any reuse of prime factors:

    period:   ~126.2 billion
    2-volume: 0.37%
    3-volume: 0.33%
    4-volume: 0.02%
    >5:       < 0.01% chance
    total:    0.7%

See?  Number theory *is* useful in real life. :)


More information about the CentOS mailing list