About 10 days ago, my RAID 1 managed with mdadm had a failure. The array consists of 2 external 2 TB hard drives which are connected via USB and I suspect there was a loose connection which lead to a failure.
According to my bash history, I entered these commands:
sudo mdadm --manage /dev/md1 --fail /dev/sda1 sudo mdadm --manage /dev/md1 --remove /dev/sda1 cat /proc/mdstat sudo mdadm --manage /dev/md1 --add /dev/sda1 cat /proc/mdstat mailx cat /proc/mdstat
I found instructions for this online but iirc, the first and/or second command failed because
/dev/sda1 was already not part of the array anymore or something like that.
Data definitely was written to the file system of the array between the failure and the point where I entered the commands above.
I assumed mdadm would copy all the data of
/dev/sdb1 over to
/dev/sda1 after I issued the 4th command which would've taken quite some time. However, when I checked back in the last line after a few minutes, it was already done.
Not knowing how it managed to apparently only copy the changed data over, I feared for the integrity of the data stored on my RAID and sha256summed
/dev/sdb1 except for the first 128 MiB because I know the first 128 MiB are different. Turns out the rest of the disks store exactly the same data respectively, so mdadm did indeed restore the integrity of the array.
How did it know what parts changed? Would it still have worked had I rebooted between the point in time where the failure occurred and the point in time I issued the commands above?