Watch linux softwareraid rebuild progress

I just recently started to play around with software RAID's under linux, and I thought I'll share a piece of code to watch the progress of a raid-rebuild.

``` {.lang:sh .decode:true} || user@workstation ~ || while [ 1 ] ; do clear ; cat /proc/mdstat ; sleep 5; done

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] md0 : active raid6 sda3[0] sdf3[5] sde3[4] sdd3[3] sdc3[2] sdb3[1] 3900774400 blocks level 6, 64k chunk, algorithm 2 [6/6] [UUUUUU] [===============>.....] resync = 75.5% (736278076/975193600) finish=760.6min speed=5234K/sec

md6 : active raid1 sdf22 sde23 sdd24 sdc25 sdb2[1] sda2[0] 530048 blocks [2/2] [UU]

md13 : active raid1 sda4[0] sdd43 sde44 sdf45 sdc4[2] sdb4[1] 458880 blocks [3/3] [UUU] bitmap: 0/57 pages [0KB], 4KB chunk

md9 : active raid1 sda1[0] sdf1[5] sde1[4] sdd1[3] sdc1[2] sdb1[1] 530048 blocks [6/6] [UUUUUU] bitmap: 0/65 pages [0KB], 4KB chunk

unused devices: ```

What you'll get is the output of '/proc/mdstats' refreshed every 5 seconds. This is intended for systems without the watch command. In my case it was the QNAP NAS ;-)
Of course this also works for every other command, so you can periodically refresh the data.

Thanks for reading!
Cheers,
Raphi