#!/bin/bash for dev in `grep "^md.*: active" /proc/mdstat | cut -f 1 -d ' '`; do echo "repair" > /sys/block/$dev/md/sync_action done