Sometimes, one comes across an application with an interface that is so bizarre, the manual has to admit that it’s aberrant. Such is the case with hdparm, a command with nearly forty single-letter option flags, some of which can be combined, most of which have multiple functions depending on their arguments, and several of which can cause horrible irreversible damage to data.
The flag I found hilarious, though, was not dangerous– it lets you set the amount of time the drive should wait, unaccessed, before it assumes it’s not being used and spins down to save electricity and wear-n-tear. The use is as such:
hdparm -S N
where N is some number. Typically you’d guess that 0 turns the feature off, and any positive integer would be a number of seconds or minutes. Oh no. I quote from the man page:
Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 sec�onds.
Then comes the clincher: “Note that some older drives may have very different interpretations of these values.”
My guess is, this is determined by hardware engineers who had only had so many bits for the value, and tried to divide 256 options into some reasonable range of timings. They’d have said, we need an option for no timeout, an option for leaving it at the vendor default, and one set aside for just in case we forget something. After that, how do we divide up the remaining options? Well, what’s the smallest increment you’d reasonably want? Five seconds. So, we’ll do it in five-second increments. But at 20 minutes adding five seconds is just silly, so they go to 30-minute intervals. At that point someone says, hey, but what if I want 21 minutes and 15 seconds? They all laugh, and assign a couple joke values because it’s 3am and they’re still at work and it’s just this one drive, right?
Of course, later, they just go with the one they used last time, and six trillion drives later, everyone has the same insane interface.