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?

Daniel
  • 3,047
  • 5
  • 22
  • 27

3 Answers3

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
Melkor333
  • 33
  • 8
Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • From `man mdadm.conf` there's also a DEVICE section which identifies block devices members of the array. So DEVICE seems deprecated? – davide Jun 04 '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 05 '15 at 05: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/

rhasti
  • 497
  • 3
  • 9
  • 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 06: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

MikeyB
  • 39,291
  • 10
  • 105
  • 189