From: Kay Diederichs Sent: April 21, 2015 03:43> On 04/21/2015 06:08 AM, Hugh E Cruickshank wrote: > > > > The second idea was to set each filesystem to a different random > > count value. This would run the risk of having two or more > > executions at the same time but it would probably not be very > > frequent. > > Using "tune2fs -c", set the max-mount-counts to a different > prime number > for each filesystem. So e.g. instead of having 20 for all of them, set > the first filesystem to 17, the second to 19, the third to 23, and the > fourth to 29. This way, three or more fscks on the same boot are quite > unlikely.Thanks but that is not much different then my second idea and does not fully avoid the problem. Regards, Hugh -- Hugh E Cruickshank, Forward Software, www.forward-software.com
On Apr 21, 2015, at 9:50 AM, Hugh E Cruickshank <hugh at forsoft.com> wrote:> > From: Kay Diederichs Sent: April 21, 2015 03:43 >> >> instead of having 20 for all of them, set >> the first filesystem to 17, the second to 19, the third to 23, and the >> fourth to 29. > > Thanks but that is not much different then my second idea and does not > fully avoid the problem.You may be missing a key fact of how prime numbers work. You can only get two or more fscks on a single reboot when the mount count is a multiple of two or more of the max-mount-count values. When those numbers are all prime, the frequency of such occurrences is much lower than when you use purely random values. With the four values that Kay provided, I calculate a 1.2% chance on average that two or more volumes will need to be checked on the same reboot. If you reboot on average once a month, that means it only happens once every 7 years or so. That means the machine may well be retired before it happens even once, and then only if you reboot that often in the first place. If you take the same set of values and add one to them to make them all even, and thus composite numbers, the chance rises to 3.3%, or about once every 2.5 years for monthly reboots. Thus, Kay?s solution is actually more than twice as good as your second solution. Interestingly, the numbers don?t actually have to be prime to take advantage of this property of integers. They just have to be *relatively* prime: http://goo.gl/bQbu5Z For example, the set {15, 19, 22, 23} isn?t all prime, but is *relatively* prime, since there is no integer other than 1 that evenly divides any pair among the set. This set gives about a 1.5% chance of a 2+ volume collision, nearly as good as Kay?s prime set. I?ve put the calculator I built to test this up here: https://gist.github.com/wyoung/7c94967bb635de48d058
On Apr 21, 2015, at 3:12 PM, Warren Young <wyml at etr-usa.com> wrote:> > With the four values that Kay provided, I calculate a 1.2% chance on average that two or more volumes will need to be checked on the same reboot.Ooops, forgot to mention one other minor detail: This calculator gives the chance or a 2+ volume simultaneous check, which is actually a much more stringent case than you ran into. If you have four volumes and are using a relatively prime max-mount-count set, you won?t get a simultaneous check of all four volumes until your reboot count equals the *product* of all values in the set. With Kay?s prime set, that means it won?t happen until you have rebooted 215,441 times. If your machine lives 10 years, that?s enough to allow for about 60 reboots a day while still having *zero* chance of a 4-volume fsck. I think it?s fair to say that Kay?s solution (or a relatively-prime set) does actually solve the problem.
From: Warren Young Sent: April 21, 2015 14:13> On Apr 21, 2015, at 9:50 AM, Hugh E Cruickshank wrote: > > > > From: Kay Diederichs Sent: April 21, 2015 03:43 > >> > >> instead of having 20 for all of them, set > >> the first filesystem to 17, the second to 19, the third to > 23, and the > >> fourth to 29. > > > > Thanks but that is not much different then my second idea > and does not > > fully avoid the problem. > > You may be missing a key fact of how prime numbers work.You are right and I stand corrected. I have done some "what if" testing. Assuming 8 filesystems and weekly reboots over a ten year period... The random numbers would result in as many as 40 weeks per year where 2, 3 or 4 fscks would be run in the same week depending on the random numbers selected. 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. Clearly the prime numbers are better. Thank, Hugh -- Hugh E Cruickshank, Forward Software, www.forward-software.com