View previous topic :: View next topic |
Author |
Message |
absolon_se n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 20 Apr 2007 Posts: 5
|
Posted: Sun Feb 17, 2013 11:54 am Post subject: UDEV: Persistent disk-name |
|
|
Hello,
I have a problem that I don't know how to tackle.
I had to reinstall my system that had 2 raids on them and now, of course, the disks are not in the proper way they should be
so I need to make UDEV to understand that the "new" sdd is the old "sdb" and so on. I've been trying to find the solution online
but to no avail.
I even tried a normal: KERNEL=="sdd", NAME="Test" and that doesn't work either so I don't know why it doesn't like the rules??
So how can I make the device-nodes from kernel to the "old" ones? I was thinking about using blockid and UUID, which would be ideal
instead of labels but I don't know how to write the rules?
Anyone that can please point me to the right direction?
/Paul |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
VoidMage Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/16259984764821973534cdc.gif)
Joined: 14 Oct 2006 Posts: 6196
|
Posted: Sun Feb 17, 2013 1:38 pm Post subject: |
|
|
Quote: | so I need to make UDEV to understand that the "new" sdd is the old "sdb" and so on |
You seem to approach the problem from the wrong direction.
Why exactly do you need the names "switched" ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
absolon_se n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 20 Apr 2007 Posts: 5
|
Posted: Sun Feb 17, 2013 1:55 pm Post subject: |
|
|
I mean that the disks are not enumerated like they used to be. I had a raid, lets say it was sdb, sdc, sdf, sde and now when I reinstalled,
not doing anything with the disks, sdb and sdd has switched places. Of course. I can sit and pull cables etc, but it's not an option if I
happen to have an USB-stick in that gets enumerated as sdb and all the others are "one step to the right". So I need to make the disks
persistent, that the disk with one UUID/label is for instance sdb, even if the kernel finds them as something else.
So I saw that you could rename it to your own names like having KERNEL==sdb, LABEL="Mydisk" but that doesn't really help me right now
since I need to get the raids going and therefore I though of UUID since the disk have an unique one. But as the example from above, taken
from a guide doesn't work either, so I'm just lost in how I should config the disks to be in the order I want them to be, not how the kernel
finds them.
Udev populates the /dev with the different sd* so I was thinking that I could make them persistent and don't care what the kernel says
it is?
How is that a wrong approach? Please advice? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23082
|
Posted: Sun Feb 17, 2013 5:16 pm Post subject: |
|
|
I suspect that VoidMage meant that, since you already have UUIDs assigned, you ought to use them directly in whatever tool is accessing the disk nodes, rather than trying to have udev rename your sdX nodes to a particular order that is then fed to your tool. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
absolon_se n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 20 Apr 2007 Posts: 5
|
Posted: Sun Feb 17, 2013 5:31 pm Post subject: |
|
|
Yes, but I created the raids with /dev/sdb->sdi and then a "hole" (disk) on sdj and then another one on sdk->sdm
Next time I will surly make the raid by UUID but the problem now is to get them up and going. Then I could do the long walk of putting a spare,
rebuild every disk with UUID or make a big backup...
I just thought that since I see that it's populating the disk-directory in the /lib/udev/60-persitant-disk... it would be modified there somewhere, like
running a blkid on the disk, match the UUID-output and then give it the sdX name that way?, but that is maybe not possible? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54817 Location: 56N 3W
|
Posted: Sun Feb 17, 2013 5:49 pm Post subject: |
|
|
absolon_se,
The UUIDs are there now. You just need to discover and use them when the raid sets are assembled.
mdadm -E /dev/<partition donated to raid> will tell your the UUID of the raid.
This is not the same as the UUID of the filesystem on the raid. Code: | $ sudo /sbin/mdadm -E /dev/sda1
Password:
/dev/sda1:
Magic : a92b4efc
Version : 0.90.00
UUID : 9392926d:64086e7a:86638283:4138a59
... |
Tell mdadm to assemble the raid with the given UUID, then the SCSI names don't matter. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
absolon_se n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 20 Apr 2007 Posts: 5
|
Posted: Sun Feb 17, 2013 6:00 pm Post subject: |
|
|
Thank you for your answer!
Yes, I have the md-UUID but my question is then, will it find the disks that have changed place like scrambled eggs or just
take the 1-4, disregarding what disks they are? That is my fear since the devices have changed the sdX-names. Is mdadm
smart enough to notice that?
Edit:
So when I assemble the raid again I have just to specify the UUID's? Asking because I'm a bit scared of loosing information. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54817 Location: 56N 3W
|
Posted: Sun Feb 17, 2013 6:07 pm Post subject: |
|
|
absolon_se,
With UUID, the disks just have to be there. mdadm will look at all the the disks to find the UUIDs it needs.
The SCSI names do not matter. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
absolon_se n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 20 Apr 2007 Posts: 5
|
Posted: Sun Feb 17, 2013 7:45 pm Post subject: |
|
|
Thank you! Seems like it worked. Have a "funny" raid now. With the names not on the order they are installed at all.
Personalities : [raid1] [raid10] [raid6] [raid5] [raid4]
md1 : active raid5 sde1[4] sdb1[0] sdd1[2] sdc1[1]
8790402048 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
md0 : active raid6 sdh1[2] sdj1[4] sdg1[1] sdf1[0] sdi1[3] sdk1[5]
7813527552 blocks super 1.2 level 6, 512k chunk, algorithm 2 [6/6] [UUUUUU]
This is what I meant with scrambled devices. They are not in order as they use to be. There seems also that if I boot with an USB-stick
it puts itself to sdb. Is mdadm intelligent enough to check that disks are still in their "order"?
I mean the order of disk in md0: 2,4,1,0,3,5 is not only annoying but a bit scary
This is why I want to make the devices persistent in the /dev so they are in order as I asked in the original question.
So the original question, can I somehow change the order? I don't understand why the order is changed at all since all I did was an reinstall. I changed
the primary disk but that is all.
Thank you again for your help! ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|