4

I was wondering if you guys could help. I am looking to mount my mdadm RAID 1 at boot.

The drive location is /dev/md127 and I would like it to mount to /media/server at boot. It is formatted to ext4. Your help will be truly appreciated.

1 Answer 1

13

You could add an entry to /etc/fstab:

/dev/md127    /media/server    ext4 defaults 0 0 

Make sure that /media/server is present:

sudo mkdir -p /media/server

You could use the UUID of the partition instead of /dev/md127. The UUID of a filesystem is unlikely to change unless you alter it, whereas the partition may change its identifier and be named md0 or md255 or something like that.

Use the blkid or lbslk command to get the UUID, and then replace /dev/md127 with UUID=xxx-xxxxx-xxxxxx-xxx in the above line:

# lsblk -o NAME,UUID
NAME    UUID
sdc     
└─sdc1  8ebc357c-3d93-fd86-0535-cb852bbc7289
  └─md2 5348f582-8a9c-43c3-bf5b-eaabd644035b
sdd     
└─sdd1  8ebc357c-3d93-fd86-0535-cb852bbc7289
  └─md2 5348f582-8a9c-43c3-bf5b-eaabd644035b
# blkid
/dev/sdc1: UUID="8ebc357c-3d93-fd86-0535-cb852bbc7289" UUID_SUB="77e19cfe-ed79-613f-bb18-b56bc30e0858" LABEL="titan:2" TYPE="linux_raid_member" 
/dev/sdd1: UUID="8ebc357c-3d93-fd86-0535-cb852bbc7289" UUID_SUB="e99d0a33-4944-4f1e-4a90-b65fa2e57b56" LABEL="titan:2" TYPE="linux_raid_member" 
/dev/md2: UUID="5348f582-8a9c-43c3-bf5b-eaabd644035b" TYPE="ext4" 

The UUID of /dev/md2 (the RAID array in this case) is 5348f582-8a9c-43c3-bf5b-eaabd644035b, so the entry would look like:

UUID=5348f582-8a9c-43c3-bf5b-eaabd644035b   /media/server   ext4    defaults  0 0
4
  • I will give that a shot, what would be the difference or advantage of using the UUID rather than the /dev/md127 ?
    – Chris
    Oct 22, 2014 at 15:16
  • The UUID of a filesystem is unlikely to change unless you alter it, whereas the partition may change its identifier and be named md0 or md255 or something like that.
    – muru
    Oct 22, 2014 at 15:18
  • that seems like a better option to use the UUID. What is the command for me to obtain the UUID of a madam raid
    – Chris
    Oct 22, 2014 at 15:20
  • @Chris Use sudo blkid, or sudo lsblk -o NAME,UUID.
    – muru
    Oct 22, 2014 at 15:22

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.