gurxsa
Posts: 3
Joined: Mon Dec 26, 2016 4:43 pm

Persistent Device Name

Tue Dec 27, 2016 6:47 pm

Hi all,
this is my first post. Excuse my english, i'm not mother tongue.
Also, i'm not so expert of Linux & C
I have a OMV 3 on my raspberry pi 2.
i've attached a hub usb to connect disk drives and usb drives.
I've created a Raid 1 array with two hard drives.
The problem is that when i turn off and on my raspberry, the disk drive name change each time (from sda to sdc for example), result the RAID 1 is broken.
I would like to assign the same name at every startup.
is it possible ?
On web i've seen something named "udevman", but i never found an example (or step by step process) that help me to fix this problem.
Could, someone of you please, be so kind to describe me how to do (if it's possible) this ?
Many thanks in advance...

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Persistent Device Name

Tue Dec 27, 2016 10:36 pm

If the drives are in a RAID, you should only ever mount the raid device /dev/mdX or /dev/md/X, not the components /dev/sdX or /dev/sdXX.

Also, mdadm should be able to recognise and assemble the array regardless of the device names the components get. A unique ID is written into each raid superblock.

Can you provide more information about what you have done, what is not working, and how you are currently fixing it?

gurxsa
Posts: 3
Joined: Mon Dec 26, 2016 4:43 pm

Re: Persistent Device Name

Wed Dec 28, 2016 11:12 am

Hi jojopi, thanks for your reply.
I try to describe what i've done.
At first time, i've connected only the two disk drives. The system had seen them as SDA and SDB. i've partitioned them with gparted and, manually, i've created the array disk (Raid 1) with the command: "mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1" and so on with the other partitions. Then i've continued to configure OMV with creating users, groups and so on. Result, each user see the correct nas disk. Then i've connected the usb devices. At the first switch off and power on of the raspberry, i've discovered that the disk name is changed and the array is "degraded" and the device list shows only one drive.
i've attached two files. The first file (ScreenShot 001.jpg) shows the actual situation of my drives. What you see as SDE yesterday was SDF. The second file (ScreenShot 002.jpg) shows what is actually the situation of one of raid disk.
Excuse if this post is too long, but i hope to have described what done, clearly.
And, most important, i've correctly figure out what you have asked me.
What misteke have i done ? Thanks for your reply.
Attachments
ScreenShot 002.JPG
ScreenShot 002.JPG (48.36 KiB) Viewed 1307 times
ScreenShot 001.JPG
ScreenShot 001.JPG (62.63 KiB) Viewed 1307 times

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Persistent Device Name

Wed Dec 28, 2016 5:27 pm

What do you have in /etc/mdadm/mdadm.conf? Each array should be described like:

Code: Select all

ARRAY /dev/md0 UUID=3343370b:4f809fe1:07fac7b7:588f1549
Not like:

Code: Select all

ARRAY /dev/md0 devices=/dev/sda1,/dev/sdb1

gurxsa
Posts: 3
Joined: Mon Dec 26, 2016 4:43 pm

Re: Persistent Device Name

Wed Dec 28, 2016 6:02 pm

no rows are present in the mdadm.conf.
Has described, i've done it manually
this is the content of that file:
---------------------------------------------------------------------------------------------------
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
# Note, if no DEVICE line is present, then "DEVICE partitions" is assumed.
# To avoid the auto-assembly of RAID devices a pattern that CAN'T match is
# used if no RAID devices are configured.
DEVICE partitions

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# definitions of existing MD arrays
MAILADDR root
-------------------------------------------------------------------------------------------------------
at this URL:
https://wiki.debian.org/Persistent_disk_names
is described, more or less, the same scenario that i have... but the solution is not clear for me...
surely because i've not so much experience for linux...
i try another way...
For your experience if i insert in the file: "/etc/udev/rules.d"
this row (for example):

Code: Select all

ENV{ID_SERIAL}=="M80F35AH" NAME="sda%n"
where the ID_Serial is the Drive Serial of one of the two disk that i use for the array.
is it valid ? will it work ?
honestly i don't want to try and (may be) broke all the system...

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Persistent Device Name

Wed Dec 28, 2016 7:40 pm

It is normal to have to specify the device names manually the first time, when you run "mdadm --create …".

Thereafter, "mdadm --assemble --scan" should be able to work out what to do. Does that command work for you now?

When all arrays are running, "mdadm --detail --scan" will give the ARRAY lines appropriate to add to mdadm.conf to enable the expected assembly on reboot.

The persistent disk names article you linked to was written for ancient versions of Debian, and I would not recommend trying it. It is not really the same as your situation, either. The author is not saying that the arrays will only work if the drives have persistent names. He is saying it will be easier to tell which drive has failed if the names always correspond to the physical bays on the front of the server.

In my experience, it is never necessary to change the standard udev rules.

Return to “Beginners”