I also experienced the same problem with a IMSM RAID 1. I believe that the problem is essentially identical to the gentoo problem which was noted earlier. I put in the following workaround which seems to work (on a clean install of Ubuntu 14.04.1 with mdadm version 3.2.5). At least, I have not seen a resync on boot since putting this in this fix.
1. Edit /etc/init.d/sendsigs (to prevent mdmon from being killed on shutdown):
OMITPIDS=`pidof mdmon | sed -e 's/ /,/g' -e 's/./-o \0'`
2. Edit /etc/init.d/umountroot (to force the system to wait for the RAID to be clean before shutdown):
##########################
#FIRST: Add the following function:
check_raid() {
log_action_begin_msg “Checking RAIDs ”
if mdadm --wait-clean --scan ; then
log_action_end_msg 0
else
log_action_end_msg 1
fi
}
#SECOND: change the call to do_stop:
#stop)
# do_stop
# ;;
I also experienced the same problem with a IMSM RAID 1. I believe that the problem is essentially identical to the gentoo problem which was noted earlier. I put in the following workaround which seems to work (on a clean install of Ubuntu 14.04.1 with mdadm version 3.2.5). At least, I have not seen a resync on boot since putting this in this fix.
1. Edit /etc/init. d/sendsigs (to prevent mdmon from being killed on shutdown):
OMITPIDS=`pidof mdmon | sed -e 's/ /,/g' -e 's/./-o \0'`
2. Edit /etc/init. d/umountroot (to force the system to wait for the RAID to be clean before shutdown):
####### ####### ####### ##### begin_msg “Checking RAIDs ” end_msg 0 end_msg 1
#FIRST: Add the following function:
check_raid() {
log_action_
if mdadm --wait-clean --scan ; then
log_action_
else
log_action_
fi
}
#SECOND: change the call to do_stop:
#stop)
# do_stop
# ;;
stop) ####### ####### #####
check_raid
do_stop
check_raid
;;
#######
It isn't clear that check_raid has to be called both before and after do_stop (probably after will work fine, but I didn't test it).