Dear mdadm developers,<br><br>Consider the following scenario (based on true story):<br><br>SETUP:<br>* a raid1 MD array is configured with the name /dev/md/data (metadata=1.0).<br>* /dev/md/data is identified in the /etc/mdadm/mdadm.conf by its UUID<br>
* /dev/md/data is assembled from the initramfs with minor /dev/md127<br><br>CRASH:<br>* [GLITCH] at some point one of the disks (/dev/sda) comprising /dev/md/data experiences a bus-failure and is correctly removed from the array.<br>
* array runs for some time in degraded state, data is being written and read from the remaining disks (/dev/sdb, sdc etc)<br>* [REBOOT] after some time, the server is rebooted<br>* at boot time initramfs script starts /dev/md/data, but kernel correctly kicks out /dev/sda from the array because the Event Counter is too old ('kicking non-fresh sda from array').<br>
* when udev starts, "mdadm --detail --export /dev/md127" correctly identifies /dev/md127 and UDEV creates a correct symbolic link:<br> /dev/md/data -> /dev/md127<br><br>* startup proceeds to execute /etc/init.d/mdadm-raid which runs "mdadm --assemble --scan".<br>
* mdadm --assemble --scan discovers the description of /dev/md/data in mdadm.conf and finds a lonely /dev/sda with a matching UUID; /dev/md126 is created out of a single /dev/sda<br>* now udev receives an ADD event for /sys/block/md126; again "mdadm --detail --export /dev/md126" says that this device must be named /dev/md/data. UDEV then re-creates the symbolic link, which now points to /dev/md126:<br>
/dev/md/data -> /dev/md126<br><br>* startup proceeds and /dev/md/data is mounted as a /home partition.<br><br>CONCLUSION:<br>* data written to /dev/md/data between GLITCH and REBOOT is lost.<br>* data written to /dev/md/data after REBOOT is stored on a buggy /dev/sda instead of a sane array (/dev/sdb,/dev/sdc)<br>
<br><br>PATCH:<br>* attached is a patch against the master of git://<a href="http://anonscm.debian.org/pkg-mdadm/mdadm.git">anonscm.debian.org/pkg-mdadm/mdadm.git</a><br><br><br>Best wishes,<br>Yury Polyanskiy<br><br>PS. Please CC me, I am not on the list.<br>
<br><br><br>