# # create a raid1 with an internal bitmap # mdadm --create --run $md0 --level=5 -n3 --delay=1 --bitmap internal --bitmap-chunk=4 $dev1 $dev2 $dev3 check wait testdev $md0 2 $mdsize1 512 mdadm -S $md0 mdadm --assemble $md0 $dev1 $dev2 $dev3 testdev $md0 2 $mdsize1 512 sleep 4 dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` if [ $dirty1 -ne 0 ] then echo >&2 "ERROR bad 'dirty' counts: $dirty1" exit 1 fi mdadm $md0 -f $dev1 testdev $md0 2 $mdsize1 512 sleep 4 dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` if [ $dirty2 -lt 400 ] then echo >&2 "ERROR dirty count $dirty2 is too small" exit 2 fi mdadm -S $md0 mdadm --assemble -R $md0 $dev2 $dev3 mdadm --zero $dev1 # force --add, not --re-add mdadm $md0 --add $dev1 check recovery check wait sleep 4 dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` if [ $dirty3 -ne 0 ] then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty3" exit 1 fi mdadm -S $md0