storaged-project / libblockdev

A library for manipulating block devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bd_md_examine fails to get UUID for DDF RAID containers

vojtechtrefny opened this issue · comments

The container UUID is not present in the mdadm --examine output, we need to use mdadm --examine --brief or mdadm --examine --export to get it.

$ sudo mdadm --examine /dev/vdc
/dev/vdc:
          Magic : de11de11
        Version : 01.02.00
Controller GUID : 4C696E75:782D4D44:6C6F6361:6C686F73:742E6C6F:63616C64
                  (Linux-MDlocalhost.locald)
 Container GUID : 4C696E75:782D4D44:DEADBEEF:00000000:4F64565F:C545EED0
                  (Linux-MD 03/17/22 10:16:15)
            Seq : 0000000c
  Redundant hdr : yes
  Virtual Disks : 1

      VD GUID[0] : 4C696E75:782D4D44:DEADBEEF:00000000:4F645665:968CD566
                  (Linux-MD 03/17/22 10:16:21)
         unit[0] : 126
        state[0] : Optimal, Consistent
   init state[0] : Fully Initialised
       access[0] : Read/Write
         Name[0] : vol0
 Raid Devices[0] : 2 (1@0K 0@0K)
   Raid Level[0] : RAID1
  Device Size[0] : 20938752
   Array Size[0] : 20938752

 Physical Disks : 1023
      Number    RefNo      Size       Device      Type/State
         0    7659c0b6  20938752K /dev/vdc        active/Online
         1    fe877c95  20938752K                 active/Online
$ sudo mdadm --examine --export /dev/vdc
MD_METADATA=ddf
MD_LEVEL=container
MD_UUID=b4f04b9f:531d58d2:33661e33:b743652c
MD_DEVICES=2

This was actually fixed in #563 (and not backported to 2.x which is why I didn't realize it), but we also need similar fix for bd_md_detail which has the same problem.