2

I have three EBS RAID 10 volumes in my /etc/fstab on an Amazon AMI hosted with AWS/EC2...

Everytime I reboot the instance, the volumes get mounted to the wrong mount points. Any ideas on how I can get these RAID volumes to mount to the correct mount points?

Correct Example

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.9G  1.3G  6.6G  16% /
tmpfs                 3.4G     0  3.4G   0% /dev/shm
/dev/md127            2.0G  129M  1.9G   7% /mnt/db
/dev/md126             35G   18G   18G  50% /mnt/web
/dev/md125            3.0G  267M  2.8G   9% /mnt/bc

After Reboot

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.9G  1.3G  6.6G  16% /
tmpfs                 3.4G     0  3.4G   0% /dev/shm
/dev/md127            2.0G  129M  1.9G   7% /mnt/bc
/dev/md126             35G   18G   18G  50% /mnt/db
/dev/md125            3.0G  267M  2.8G   9% /mnt/web

My /etc/fstab

LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc   proc    defaults        0   0
/dev/md127  /mnt/db     xfs     defaults        0   0
/dev/md126  /mnt/web    xfs     defaults        0   0
/dev/md125  /mnt/bc    xfs     defaults        0   0
3

blkid

Instead of the device handles you might want to try using the UUID for each of the devices. You can get the devices UUID's using the command blkid.

$ blkid
/dev/lvm-raid2/lvm0: UUID="2123d4567-1234-1238-adf2-687a3c237f56" TYPE="ext3" 

Then add this to your /etc/fstab:

UUID=2123d4567-1234-1238-adf2-687a3c237f56    /mnt/db     ext3     defaults        0   0

RAID Name?

@Patrick mentioned in the comments to create a RAID volume name. I was reluctant to suggest this because I quit honestly didn't understand your setup. But I'll include the details for creating the MD device just in case. Something like this:

$ sudo mdadm --assemble /dev/mdraid10 --name=myraid10 --update=name \
         /dev/md125 /dev/md126 /dev/md127

I've been using RAIDs for 10+ years and I've never set the name of the device though. I usually use the UUID or the actual device handle of the RAIDs instead.

Example

$ cat /proc/mdstat 
Personalities : [raid1] 
md0 : active raid1 sdc1[0] sdb1[1]
      2930266432 blocks [2/2] [UU]

unused devices: <none>

From the above output, the device handle is /dev/md0. So now you can check it's details:

$ mdadm --detail /dev/md0 
/dev/md0:
        Version : 0.90
  Creation Time : Wed Dec 16 22:55:51 2009
     Raid Level : raid1
     Array Size : 2930266432 (2794.52 GiB 3000.59 GB)
  Used Dev Size : -1
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Sat Jul 20 07:39:34 2013
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 2f2b26fd:ce4d985f:6a98fc18:3e8f2e46
         Events : 0.23914

    Number   Major   Minor   RaidDevice State
       0       8       33        0      active sync   /dev/sdc1
       1       8       17        1      active sync   /dev/sdb1

I then typically add the above UUID to /etc/mdadm.conf using this command:

$ sudo mdadm --detail --scan
ARRAY /dev/md0 level=raid1 num-devices=2 metadata=0.90 UUID=2f2b26fd:ce4d985f:6a98fc18:3e8f2e46 

$ sudo mdadm --detail --scan > /etc/mdadm.conf

In my /etc/fstab to mount this RAID I'd use /dev/md0:

/dev/md0        export/raid1 ext3    defaults            1 2

I also always put LVM on top of my RAIDs. But that's another topic altogether.

References

4
  • Or name the raid volume and use /dev/md/myname. – phemmer Jul 20 '13 at 6:46
  • 1
    Nothing to add, but I wanted to tell you this was a well though out and helpful answer. – BillMan Jun 24 '14 at 14:47
  • In your first example, blkid reports a fs type of ext3, but then in the suggested fstab entry, you're mounting it as xfs. Assuming that's just a typo? – aidan Jul 10 '14 at 1:54
  • @aidan - thanks for the head up. Fixed the typo. – slm Jul 10 '14 at 1:58

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.