I'm using GPT as my partitioning scheme. I check the UUID's of my partitions:

# ls -l /dev/disk/by-partuuid/
total 0
lrwxrwxrwx 1 root root 10 Oct 18 22:39 0793009a-d460-4f3d-83f6-8103f8ba24e2 -> ../../sdb3
lrwxrwxrwx 1 root root 10 Oct 18 22:39 13f83c47-ad62-4932-8d52-e93626166e7f -> ../../sdc3
lrwxrwxrwx 1 root root 10 Oct 18 22:39 1b247b1f-0b7b-419e-bc3b-0f90cbadb87c -> ../../sdc2
lrwxrwxrwx 1 root root 10 Oct 18 22:39 224d5933-7a23-4833-b785-79a67c9b9306 -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 18 22:39 2ff625b2-b96b-4ce5-b752-57cdf7092258 -> ../../sda3
lrwxrwxrwx 1 root root 10 Oct 18 22:39 449956f9-7289-49ed-9a37-ed6be9264d1c -> ../../sdb1
lrwxrwxrwx 1 root root 10 Oct 18 22:39 a2a95e45-7e4c-4b20-a2bd-66d96e737590 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Oct 18 22:39 a8c07f74-9d6d-4f45-9453-dd2e6998f100 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 18 22:39 c2c9e94c-9c73-4d6e-a4ec-2229f56152e8 -> ../../sdc1

And add /dev/sdc2 using its UUID:

# mdadm /dev/md0 --add /dev/disk/by-partuuid/1b247b1f-0b7b-419e-bc3b-0f90cbadb87c
mdadm: added /dev/disk/by-partuuid/1b247b1f-0b7b-419e-bc3b-0f90cbadb87c

But when I look at the details of the RAID array it reports /dev/sdc2 instead of the UUID.

# mdadm --detail /dev/md0
        Version : 1.2
  Creation Time : Thu Oct 18 21:52:43 2012
     Raid Level : raid1
     Array Size : 1048564 (1024.16 MiB 1073.73 MB)
  Used Dev Size : 1048564 (1024.16 MiB 1073.73 MB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Fri Oct 19 15:57:19 2012
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : cow:0  (local to host cow)
           UUID : 9e691db1:f8fcc7d8:f56d9c11:1c202693
         Events : 47

    Number   Major   Minor   RaidDevice State
       2       8       34        0      active sync   /dev/sdc2
       1       8       18        1      active sync   /dev/sdb2
  1. Is it impossible to construct a RAID array using UUID's?
  2. Or is it using the UUID but reports the normal name to increase the readability? In that case, how can I tell?
  3. I would like to use UUID's so that I may move the disks around freely in the machine without breaking anything. Doesn't that sound like a good idea?

mdraid always allows you to move disks around freely in the machine, regardless of how you add the disk to the array. It tracks the disks by the RAID metadata (superblocks) stored on the disk.

Note that this assumes mdadm can find the disks when its assembling the arrays. The default (specified in /etc/mdadm/mdadm.conf) is normally DEVICE partitions, which means to look at all partitions (on all disks) checking for RAID superblocks. It checks for a match of the array name or UUID (depending on what you say to do in that config file), notice how both are in your --detail output.


DEVICE partitions
ARRAY /dev/md0 metadata=1.2 UUID=9e691db1:f8fcc7d8:f56d9c11:1c202693

When told to assemble /dev/md0, mdadm will scan all partitions on the system looking for 1.2 superblocks with the UUID 9e691db1:f8fcc7d8:f56d9c11:1c202693. It'll read the device number, etc. out of each, and use that information to assemble the array.

You would only change the DEVICE line if scanning all partitions is expensive. For example, if you have hundreds of them, over the network. Then you could list the relevant devices there, however you'd like (by UUID should work fine).

  • Thanks! By default my /etc/mdadm/mdadm.conf says # by default (built-in), scan all partitions (/proc/partitions) and all containers for MD superblocks. alternatively, specify devices to scan, using wildcards if desired.. The DEVICE line is outcommented by default for Ubuntu. But I guess the default behavior will very perfectly! (I don't have so much it will have to scan)
    – Deleted
    Oct 19 '12 at 18:35
  • How to know the UUID of superblock to put in config file?
    – Dims
    Oct 3 '14 at 23:06
  • @Dims mdadm will give you the UUID for the array, blkid and several other tools for the block devices... Perhaps ask a question on that with details?
    – derobert
    Oct 4 '14 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.