Path of md device wrong after reboot

Posted on

Path of md device wrong after reboot – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, raid, ubuntu-12.04, software-raid, mdadm.

I have to set up a software raid (level1) on a Ubuntu server 12.04. It should serve files in the network via Samba. The server has the following disks:

  • 250gb Sata hdd (Ubuntu is installed on that drive)
  • 2 TB Sata hdd (first disk in raid array, data disk)
  • 2 TB Sata hdd (second data disk)

I created one partition on every data disk with the type Linux raid autodetect. In the second step I created the raid1 with the following command:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

After that, I added the array to the mdconf:

mdadm --examine --scan >> /etc/mdadm/mdadm.conf 

The problem is: After a reboot the array is not available on the path /dev/md0. Instead of that it gets reassembled as /dev/md/0 but it is not very reliable. Has anybody a solution for this issue?

Solution :

As I recall the md0 keeps coming back up as a different device name.

The answer is after setting up mdmadm.conf, run update-initramfs -u
Which basically copies mdmadm.conf to the initial ramdisk so it’ll work after the next reboot.

Check out your /etc/mdadm/mdadm.conf The device it came up as should be specified in that file. You can make changes to that file and make the raid volumes come up differently. You might have a line that looks something like this..

ARRAY /dev/md/0 metadata=1.2 UUID=7d2bf7e5:dc6edd5c:3ca12e46:8c9e5d4b

This means mdadmin the device /dev/md/0 will be composed all the devices that have RAID meta data identifying them as UUID=7d2bf7e5:dc6edd5c:3ca12e46:8c9e5d4b.

As long as you don’t change your mdadm.conf, when that RAID volume will pretty much always be /dev/md/0. It does not change unpredictably on any distro I have seen.

With the newer 1.2 meta data you can also assign a logical name to a RAID volume.

So on my system I have set a name on my volumes and configured my mdadm.conf like this. In my opinion these logical names make the volume more portable to other systems, plus since this name is stored as part of the meta data it is far easier to identify what things are, if you assign meaningful names to the array.

ARRAY name=zoredache:3tb-r1-vol1
ARRAY name=zoredache:3tb-r1-vol2

The devices come up as /dev/md/3tb-r1-vol1, and /dev/md/3tb-r1-vol2.

Leave a Reply

Your email address will not be published.