I'm attempting to get a software RAID array going using [this guide][1]. I've worked my way through preparing the second disk (/dev/sdb) without any errors.

After running:

mkswap /dev/md5

I run:

mdadm --examine --scan

Before piping it to my /etc/mdadm/mdadm.conf file. Problem is, I seem to be getting two results for the same device:

root@test:~# mdadm --examine --scan
ARRAY /dev/md/5 metadata=1.2 UUID=9985ef40:2eb8407d:c0a195b1:509136fe name=test:5
ARRAY /dev/md/1 metadata=1.2 UUID=34de79db:470dce04:ece45660:b4af82d5 name=test:1
ARRAY /dev/md/5 metadata=1.2 UUID=27796750:70770c0a:f5af0aca:5367090e name=test:5

I am following this tutorial. The machine I'm testing on had a software RAID array on it before, but I ran mdadm --zero-superblock on both partitions to ensure any remnants were gone.

Any ideas as to why I'm getting two entries for the same disk?

  • try mdadm --detail /dev/md* or --detail --scan – frostschutz Nov 23 '16 at 17:26
  • So those two commands list the last two entries in my original command. Is there a way to remove/delete the first one? Thanks again for your help on this. – tparrott Nov 23 '16 at 17:31
  • Hmmm, should be three. mdadm -v --examine --scan would list the devices. – frostschutz Nov 23 '16 at 17:39
  • Ok -- in looking at this, it appears as though the first /dev/md/5 device is pointing to /dev/sda5, which is probably my issue here. Any idea how I disassociate /dev/md/5 from /dev/sda5? – tparrott Nov 23 '16 at 17:41
  • If sda5 is not part of any raid, you can mdadm --zero-superblock it. – frostschutz Nov 23 '16 at 17:49

/dev/md5 and /dev/md/5 is not the same thing. You probably actually do have three arrays, only you ended up with the same name for two of them.

/dev/md5 is a numbered md device, and /dev/md/5 is a named one. Names are arbitrary, can be anything. You could make a /dev/md/swap if you so desire. You update it with --update=name, on creation it's the --name= option, or simply specifying /dev/md/name in the first place. The manpage describes this in some detail.

Personally I don't like md names very much. It's particularly pointless when you end up using some number as a name. You can stick with numbers in the first place then. If you want names, use descriptive ones (root, home, swap, ...).

In general, mdadm --examine --scan is just a starting point. You really only need the UUID so you could do something like this:

ARRAY /dev/md0 UUID=9985ef40:2eb8407d:c0a195b1:509136fe
ARRAY /dev/md1 UUID=34de79db:470dce04:ece45660:b4af82d5
ARRAY /dev/md2 UUID=27796750:70770c0a:f5af0aca:5367090e

Don't forget to add a MAILADDR (and have a mdadm monitor service running).

| improve this answer | |
  • Thanks for the reply -- how can you tell which one is the numbered and which is the named? They're both listed as /dev/md/5 in my mdadm output... – tparrott Nov 23 '16 at 17:18

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.