Differences between revisions 5 and 6
Revision 5 as of 2010-01-20 17:35:00
Size: 2624
Editor: FranklinPiat
Comment: This page has duplicate content with the page "udev".
Revision 6 as of 2010-01-20 22:14:19
Size: 2620
Editor: ?TomasDulik
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
## <<TableOfContents(2)>> <<TableOfContents(2)>>

Translation(s): none


This page describes how to achieve persistent disk names according to disk bay position, generally - according to physical device path. It is tested on Debian Lenny but it should work on Debian Etch as well

The problem

When using Linux SW RAID made of several SATA hotswap disks, I have found a big problem: when a disk in the array is physically removed and then inserted again, the kernel does not assign it the same name, but a first free one.

Example:

I had a RAID made of 2 disks – sda and sdb.

When I physically remove the sda disk (without first executing mdadm –fail /dev/md* /dev/sda*; mdadm –remove /dev/md* /dev/sda*) and then insert this disk back, the disk never appears as /dev/sda. Instead, it is named as /dev/sdc. It seems that the kernel uses first free drive letter, because it thinks that /dev/sda is still used.

Another problem:

If /dev/sda fails completely such a way, that the server will not detect it. Then, if the server is rebooted, the second physical disk, named previously /dev/sdb, will become /dev/sda! This is very confusing, because how will you know which physical disk should be replaced?

The behaviour I would like to see is: disk in disk bay 1 will be named /dev/sda disk in disk bay 2 will be named /dev/sdb – even if there is no disk in disk bay 1 etc.

Then, if /dev/sda fails and the server is restarted, the /dev/sda will be missing and the second disk is still /dev/sdb. And I am able to tell the operator „please go and exchange the disk in disk bay 1“

How to do this?

After 4 days of trial&error experiments, I have developed this solution:

The solution

Although it may sound simple, Google have not found any solution for this problem. First of all, you have to find the UDEV physical device path of your disks. Disk bays are connected to the mainboard in a fixed way, which corresponds to the UDEV physical device path. For each disk, the path is printed by udevadmcommand. Example for /dev/sda and /dev/sda2:

 udevadm info --query=path –name=/dev/sda
 /devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda

(to be finished)

See also

  • udev's Persistent Device name
    TODO: Merge the content of both pages.