Beware the man page! mdadm

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts




So you see this in the man page for mdadm
-t, --test

and you figure the -t will test and return the status code (as there is no detailed output)
Well, the line below the -t option tells the whole story!
    When used with --detail, the exit status of mdadm is set to reflect the status of the device. 

So we just output 0 for we are happy, unless we want verbose output with many lines ---AND-- to set the status return code
Ugh, why have the -t or --test options at all? Is it just there to see if the raid device exists or not?


From the looks of this output, I don't think I would ever trust the mdadm --test flag!
http://www.mail-archive.com/linux-raid@vger.kernel.org/msg06567.html
text-version.txt

Aha! From the changelog, one can see it is a chicken and egg issue:

Changes Prior to 1.4.0 release
...
    -   Add --test option to --detail to set a meaningful exit status.
...

So we can see that the --test option was added after the --detail option and should have been an "option" to the --detail flag after all!
(and not a stand alone option that does anything useful on its own)...



[æ]