Reading from /sys/block/*/stat does not provide the disk major and minor
numbers (versus reading from /proc/diskstats). When saving the disk data
back to a temp state file, these empty values for the disk major and
minor numbers get turned into undef values on state restore.
On the line: `my ( $prev_time, %prev_diskstat ) = restore_state();`
`%prev_diskstat` will 'slurp' up all returned values from the function
call (converting the list into key value pairs) but if one of last
values is from the major or minor number (which will be undef), the key
(major or minor) will be sent but the undef value will not be
sent. Hence this results in an attempted hash assignment where one of
the key values pairs is missing a value and thus the 'Odd number of
elements in hash assignment ' warning is thrown.
add env.humanid
add check if device exist
add if no limitations administered via 'quota' for the device the total line is shown only
fix some nitpicking details
add some comments
add env.humanid
add check if device exist
add if no limitations administered via 'quota' for the device the total line is shown only
fix some nitpicking details
add some comments
* redirect error message of `ls` to /dev/null
* fetch mismatch_cnt to get correct count
* https://www.kernel.org/doc/Documentation/md.txt
* sync_completed: the number of sectors that have been completed
* mismatch_cnt: the number of errors that are found
* mdadm needs super-user privileges, but /proc/mdstat is readable for nobody
* fetch an array state from mdstat 'reshape|check|resync|recovery'
* reshape, recovery: rebuilding array -> set percent to _rebuild.value
* check, resync: data scrubbing or mirror rebuilding => set percent to _check.value
* resync=DELAYED|PENDING => set both to zero, because details are unknown even if using mdadm
* more info about /proc/mdstat => kernel src:/drivers/md/md.c, md_seq_show()
* one line regular expression matching to multiline text is a bit hard to picture
* apply regular expressions to each line
* first line should like "active raid1 sda1[0] sdc1[2] sdb1[1]"
* second line should like "123456 blocks super 1.2 [2/2] [UU]"
* third line will appear when the array is in action