4

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?

3 Answers 3

4

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
/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
2
  • 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, 2015 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, 2015 at 5:52
3

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/

2
  • 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, 2012 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. Jul 19, 2019 at 6:33
1

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

/dev/disk/by-id/ata-ST9320423AS_5VH56VSB

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .