mdadm RAID1 Array Shows 'wrong UUID' and Refuses to Re‑add Disk After Transient USB Enclosure Disconnect
Environment
Debian 12 server with mdadm RAID1 composed of two 2TB SATA disks: one internal (sda) and one in an external USB hot-swap enclosure (sdb). mdadm 4.2, kernel 6.1. After accidental power loss to the enclosure while OS running, the external disk reconnected and now shows mdadm error on assembly.
Symptoms
mdadm --detail /dev/md0 reports only one active device (sda) and the other device shows 'spare' with event count mismatch and 'wrong metadata' when attempting mdadm --add /dev/md0 /dev/sdb. /var/log/syslog shows repeated mdadm messages: 'Device … has wrong UUID 0000: not in array' and kernel messages about 'SCSI disk removed/added'. Filesystem (ext4) mounted read-only occasionally due to clean unclean flag concerns.
Observations
smartctl -a on the external disk shows no SMART errors. mdadm --examine /dev/sdb reports a valid raid superblock but with an older event count than sda. The external enclosure exposes the drive as /dev/sdb but with slightly different serial ordering occasionally. There is no apparent hardware damage; the array had been healthy prior to the disconnect. dmesg shows USB reset messages and slight device path changes when reconnected.
Already attempted
Tried mdadm --add, mdadm --assemble --update=resync, recreated superblock on spare (sketchy), and ran fsck on replica (did not write changes). Did not attempt zeroing superblocks because of data safety concerns. Rebooted server once (array assembled degraded on boot), then reconnected enclosure before boot — same result. No backups of entire disk image available beyond regular file backups.
Question
What safe diagnostics and recovery steps can I take to restore the RAID1 mirror without risking data loss, and how can I avoid permanently recreating array metadata that might make recovery impossible?
Verified community troubleshooting
No answers yet..