Am 22.06.26 um 07:50 schrieb Michel Verdier:
On 2026-06-21, Paul Leiber wrote:

I managed to rebuild the md RAID1 using the data on the seemingly failed
device (partition_1). First, I did a dd dump of partition_2 (currently in
usage) in order not to lose data. Then, I recreated the RAID1 using the data
from partition_1:

mdadm --stop /dev/md0 # This stops the degraded RAID1
mdadm --assemble --update=uuid /dev/md0 /dev/mapper/partition_1 # This creates 
a new RAID1 using the partition_1, a new array UUID is required in order for 
--assembly to work
mdadm --manage --add /dev/md0 /dev/mapper/partition_2 # This adds partition_2 
to the RAID1, contents of partition_1 are replicated to partition_2 
automatically
Your commands are strange : the partitions should be the disk partitions
from /dev and not mapped ones. Or you have another layer ? From where
come /dev/mapper/partition_1 and /dev/mapper/partition_2 ?
The partitions are LUKS encrpyted and hence decrypted before being assembled 
into the RAID array. Thus the mapped drives.

Beside this it is much quicker and safer to go this way :
- do not stop the md array (and thus the assemble is not needed)
- remove the failed partition
   mdadm --manage /dev/md0 --remove "failed partition"
- add the new clean partition
   mdadm --manage /dev/md0 --add "good partition"
- and let mdadm sync the array


There was a partition which md claimed was failed (partition_1) which contained 
the newer database. There was a partition the degraded array was using 
(partition_2) which contained the older database. I wanted to keep the newer 
database on the seemingly failed device.

I was not sure if

1) it is possible to remove all devices from a md array (removing partition_2 
would have resulted in an array without any partition)
2) adding a device with data on it I want to keep (partition_1) to an array is 
possible without losing the data (adding partition_2 to the freshly created md 
array resulted in the data on partition_2 being overwritten, as intended, but I 
wanted to avoid that partition_1 is overwritten with data from partition 2)

Hence I decided to reassemble the array starting with partition_1 and adding 
partition_2.

Are you positive that the procedure you recommend would have ended in the same 
result?

Reply via email to