3

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?

flammi88
  • 133
  • 1
  • 4

2 Answers2

3

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.

hookenz
  • 14,472
  • 23
  • 88
  • 143
0

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.

Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • It doesn't change unpredictably. I removed one disk out of the array with the machine powered off. On the next startup the raid name changed and can't boot because /dev/md/ can't be mounted... Have you tested your solution already after you removed a disk while the machine is powered off? – flammi88 Nov 07 '13 at 00:28
  • Removing a disk should not result in any name changes. I have swapped disks offline many times after failures of an individual drive in an array. The UUID of the RAID volume doesn't change, and if your configuration file doesn't change and there are enough reaming drives to re-assemble the volume, then there simply should not be any problems. – Zoredache Nov 07 '13 at 00:32