I want to create a soft RAID-5 and use UUIDs im the mdadm config file. So I have four disks with 1 partition each that spans the whole disk. But since the partitons don'5 have a filesystem, blkid does not give a UUID. Is there a way to do that?


You first create the RAID5 device and then use the UUID of it in your mdadm.conf, not the UUID for a filesystem:

# mdadm --detail /dev/md0
        Version : 1.2
           Name : enterprise:0  (local to host enterprise)
           UUID : 7d2bf7e5:dc6edd5c:3ca12e46:8c9e5d4b
         Events : 48

    Number   Major   Minor   RaidDevice State

So I have a mdadm.conf of

ARRAY /dev/md/0 metadata=1.2 UUID=7d2bf7e5:dc6edd5c:3ca12e46:8c9e5d4b name=enterprise:0
|improve this answer|||||
  • From man mdadm.conf there's also a DEVICE section which identifies block devices members of the array. So DEVICE seems deprecated? – davide Jun 4 '15 at 13:47
  • I am not aware of it being deprecated. It just isn't necessary. The kernel will auto-discover a lot. AFAIK 99% of the time you don't need to use that. But I am sure there are situations where it wouldbe useful. – Zoredache Jun 5 '15 at 5:52

First create your desired raid array with mdadm command. As soon as this is done you will have a UUID for the md. Then you can create a mdadm.conf with

mdadm --examine --scan > /etc/mdadm.conf

Verify later on with ls -l /dev/disk/by-uuid/

|improve this answer|||||
  • 3
    On some distributions, the config file is on /dev/mdadm/mdadm.conf. Second, I think you meant >>, which would append to the file (just as a comment for other readers here) – Daniel Dec 21 '12 at 21:20
  • Just > also works, if you just need that one line in the file. You will overwrite all other settings, of course, but this will have them take on their default values, which was perfect in my case. – rudolfbyker Jul 19 '19 at 6:33

Use the entries in /dev/disk/by-id to reference the parts of the RAID. For example:


|improve this answer|||||

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.