Linux – mdadm and blkid give different uuid

centos6linuxmdadmraid1software-raid

We recently replaced a hard disk in a server and reinstalled the operating system (Centos 6)

The raid rebuilds itself every boot; /dev/md2 is losing a disk each time apparently. Always the same array, /dev/md2 :

# mdadm --detail /dev/md2
 /dev/md2:
    Version : 1.0
  Creation Time : Tue Jul 31 19:26:14 2012
         Raid Level : raid1
     Array Size : 1462516600 (1394.76 GiB 1497.62 GB)
  Used Dev Size : 1462516600 (1394.76 GiB 1497.62 GB)
   Raid Devices : 2
      Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Mon Aug 20 16:07:51 2012
          State : active, resyncing 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

  Resync Status : 13% complete

       Name : rescue:2
       UUID : dfdcd9c4:24381dd7:25ffb77a:9bc2784c
     Events : 112

Number   Major   Minor   RaidDevice State
   0       8        3        0      active sync   /dev/sda3
   1       8       19        1      active sync   /dev/sdb3

The only inconsistency I can find (I am no expert at RAID) is that blkid comes up with the following:

# blkid 
/dev/sda3: UUID="73315a4d-2885-45ed-88e9-00c66d449115" TYPE="ext4" 
/dev/sdb3: UUID="dfdcd9c4-2438-1dd7-25ff-b77a9bc2784c" UUID_SUB="72ffe87d-3105-dd6c-5b5c-58b14c2afc7f" LABEL="rescue:2" TYPE="linux_raid_member" 
/dev/md2: UUID="73315a4d-2885-45ed-88e9-00c66d449115" TYPE="ext4"

The UUID reported by blkid for md2 is not the same as the one reported by mdadm. And also, sda3 has the same UUID in blkid as md2.

Best Answer

Hehe six months later... but I'll try to answer nonetheless.

mdadm --examine --scan shows you the several RAIDs' uuids which should be consistent with mdadm.conf For each RAID, all the partitions that make the RAID share this same uuid.

blkid gives you the filesystem uuids which should be consistent with fstab

So blkid should show you something like:

/dev/sda3: UUID="dfdcd9c4-2438-1dd7-25ff-b77a9bc2784c" TYPE="linux_raid_member" 
/dev/sdb3: UUID="dfdcd9c4-2438-1dd7-25ff-b77a9bc2784c" TYPE="linux_raid_member" 
/dev/md2: UUID="73315a4d-2885-45ed-88e9-00c66d449115" TYPE="ext4"

where /dev/sd[ab]3's uuid is the RAID uuid

You could try to recreate the RAID.

Is /dev/sda3 part of a RAID? (You can check that with mdadm --examine /dev/sda3)

If it is, then you can do something similar to this:

mdadm --create /dev/md[x] --assume-clean --level=<raidLevel> --verbose --raid-devices=<numberOfDevices> /dev/sd[x]3