I am working with software raid in Linux. When I start the recovery of a raid array after a disk failure this task happens in background. /proc/mdstat should show the estimated time of recovery but it is not correct. In my case /proc/mdstat was showing estimated 15 hours but the recovery was done in around 10 hours. Is there a way to know exact time of execution of recovery daemon?

link|improve this question
How about the kernel log? Otherwise, dmesg shows log messages (printk's) which include (depending on your kernel config) the number of seconds since kernel bootup. – Friek Jan 31 at 20:15
@Friek sorry but i couldn't see timing information with dmesg.it is only showing log messages. thanks for the reply. – raj_gt1 Feb 1 at 9:52
feedback

migrated from stackoverflow.com Feb 2 at 3:32

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 1 down vote accepted

You can run a simple script in the background that checks for the "rebuilding status" and dumps the time it's been waiting:

tick=$(date +%s)
while [ -n "$(cat /proc/mdstat | grep 'rebuilding')" ]; do
    sleep 10
done
tock=$(date +%s)
echo $(($tock-$tick))

mdadm also has a --monitor option that will sendmail when events are raised. I've never used it, but it may be worth looking into since a completed rebuild may qualify as a noteworthy event.

link|improve this answer
thanks. both script and --monitor option worked for me . --monitor option is quiet sophisticated as it can e-mail on the state change of array. – raj_gt1 Feb 1 at 10:01
glad to hear i helped. accept the answer? :) – user112358132134 Feb 1 at 16:49
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.