You are not logged in.

#1 2018-02-25 23:22:17

chris_sugden
Member
Registered: 2018-02-23
Posts: 3

Forgot to randomize UUID for RAID replacement drive

My Arch Linux server has been up for a year until a drive failed in each of its two Level 1 RAIDs.  I use mdadm to handle the RAIDs.

After replacing, I ended up with each pair of disks having the same UUID.  I had used sgdisk to copy the partitioning, but didn't run sgdisk -G to "randomize" the UUIDs.

If this is a problem, how should I fix it?

Outline of script:
1. Copy the partition table info from the drive still in the RAID
#2. Randomize the UUID of the new drive (This step originally forgotten)
3. Add new drive to RAID

I realized the problem after the drives were synched and lsblk -f reported the same UUID for each of the two drives in each RAID.

To fix, I thought this would work:
1. Fail the new drive
2. Remove the new drive
3. Use sgdisk -G to randomize the UUID
4. re-add the drive back into the RAID

These commands succeeded, but lsblk -f did not change.

My next guess at a fix was going to be brute force:
1. Fail/Remove the drive
2. Zero the superblocks, repartition and format the new drive manually
3. Run my script - excluding the sgdisk -G since I've covered that manually

Offline

#2 2018-02-26 00:26:50

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: Forgot to randomize UUID for RAID replacement drive

mdadm doesn't care whatsoever about PARTUUIDs. It cares about its own metadata. So in regards to mdadm, `sgdisk -G` doesn't do anything (but it doesn't hurt, either).

But it sounds like you're talking about different UUID, anyway. Pretty much everything has its own UUIDs... partitions, mdadm (both array and device UUIDs), lvm (PV, VG, and LV UUIDs), filesystems, ...

mdadm Array UUIDs are supposed to be identical for all drives in that array, however each drive has its own Device UUID. You can see that in mdadm --examine.

     Array UUID : d8b8b4e5:e47b2e45:2093cd36:f654020d # shared by all drives of that array
[...]
    Device UUID : 3c3e6eac:21393f7a:16b75728:0934d88e # unique to each drive

If you had issues with mdadm UUIDs, chances are you would not be able to assemble your RAIDs correctly. So do check if there is actually any problem (if in doubt, show mdadm detail/examine output).

If you actually really have two different arrays, sharing the same array UUID for whatever reason, you'd have to change one with mdadm --assemble /dev/mdX --update=uuid /dev/drivea /dev/driveb ... but this only applies if you're already unable to assemble them normally.

Last edited by frostschutz (2018-02-26 00:29:42)

Offline

Board footer

Powered by FluxBB