4

I am using Arch Linux. I have three functioning RAID arrays via MDADM:

~ cat /etc/mdadm.conf                                                                                                                                                                                                                           
ARRAY /dev/md0 metadata=1.2 name=beast:0 UUID=564fbbac:07f9bbeb:07ef9229:1d8fd77e
ARRAY /dev/md1 metadata=1.2 name=beast:1 UUID=7559b085:3b4715cc:59205fdd:12c0db08
ARRAY /dev/md2 metadata=1.2 name=beast:2 UUID=2dddbf33:26249617:ef8f8b65:c9670bdb

I have three directories in /run/media that I try to automount these mdadm arrays via fstab:

#THE FOLLOWING SHOULD WORK BUT AUTOMOUNT FAILS!!!!!
#UUID=564fbbac:07f9bbeb:07ef9229:1d8fd77e   /run/media/tcarpent/MDADM_SYSRAID   ntfs-3g   auto,user,rw,exec,nofail     0       0
/dev/md0                                    /run/media/tcarpent/MDADM_SYSRAID   ntfs-3g   auto,user,rw,exec,nofail     0       0

#THE FOLLOWING SHOULD WORK BUT AUTOMOUNT FAILS!!!!!
#UUID=7559b085:3b4715cc:59205fdd:12c0db08    /run/media/tcarpent/MDADM_MISCRAID  ext4      auto,user,rw,exec,nofail     0      0
/dev/md1                                      /run/media/tcarpent/MDADM_MISCRAID  ext4      auto,user,rw,exec,nofail     0     0

#THE FOLLOWING SHOULD WORK BUT AUTOMOUNT FAILS!!!!!
#UUID=2dddbf33:26249617:ef8f8b65:c9670bdb    /run/media/tcarpent/MDADM_MEDIARAID ext4     auto,user,rw,exec,nofail     0       0
/dev/md2                                    /run/media/tcarpent/MDADM_MEDIARAID ext4     auto,user,rw,exec,nofail     0    0

Using the commented out UUID lines, automount does not work. I see the drive as 'active but not mounted' in webmin, but am required to mount it, and enter my password, then the drive mounts. However, with the /dev/,,, lines, automount works, no password required.

What gives? I've been told to ALWAYS fstab with UUIDs and never device names so I want to fix this.

10

The UUID seen in mdadm.conf are related to the MD drivers.

The UUID used in fstab are related to filesytems.

What you need are the filesystem UUID numbers. You can get them with a command line

sudo dumpe2fs /dev/md0 | grep UUID

So in my case:

$ grep md/0 /etc/mdadm/mdadm.conf                                              
ARRAY /dev/md/0 metadata=1.2 UUID=d634adc8:69deedd8:d491a79e:69aeff78

$ sudo dumpe2fs /dev/md0 | grep UUID  
dumpe2fs 1.42.12 (29-Aug-2014)
Filesystem UUID:          195237da-8825-45fb-abf7-a62895bd0967

$ grep boot /etc/fstab
UUID=195237da-8825-45fb-abf7-a62895bd0967 /boot           ext4    defaults        0       2

So we can see the UUID used is the filesystem UUID and not the MD UUID.

  • So this command works for md1 and md2, but gives tjhe followinfg for md0: 'sudo dumpe2fs /dev/md0 | grep UUID 28.6s  Sun 14 Aug 2016 08:10:57 AM EDT dumpe2fs 1.43.1 (08-Jun-2016) dumpe2fs: Bad magic number in super-block while trying to open /dev/md0' – Tommy Aug 14 '16 at 12:19
  • /dev/md0 is an ntfs-3g partition, whereas md1 and md2 are not, does that have to do with it? – Tommy Aug 14 '16 at 12:22
  • Yes, I don't know if ntfs-3g had a UUID you can use this way. If there is a UUID then you'll need to find another way of finding it; dumpe2fs only works with ext2/3/4 filesystems. – Stephen Harris Aug 14 '16 at 12:40
  • 1
    The blkid command will also give you all UUIDs regardless of filesystem, and faster than waiting for dump to finish – EkriirkE Sep 28 '19 at 0:10

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.