Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

OS: Linux 2.6.18 (RedHat-based distro)

I am transitioning from one iSCSI NAS to another iSCSI NAS. I have them both connected so that I can transfer data. However, each time I reboot the NAS that maps to /dev/sdd may change; sometimes it's the old one, sometimes it's the new one. Is there a way that I can set this to be consistent between reboots? Thanks!

share|improve this question

1 Answer 1

The names of entries in /dev are determined by udev. Find some distinguishing characteristic such as the serial number, then add rules like the following:

KERNEL=="sd*", ATTR{vendor}=="Yoyodine", ENV{ID_SERIAL}=="123-abc", NAME=="sdd"
KERNEL=="sd*", ATTR{vendor}=="Yoyodine", ENV{ID_SERIAL}=="123-def", NAME=="sde"

On Debian, you would add these in a file in the directory /etc/udev/rules.d/, for example /etc/udev/rules.d/mydisks.rules. I think most distributions use this location.

You can use ATTR, ENV and other criteria to match a device (see the udev documentation for the full list of possibilities). Run udevinfo -a -n /dev/sdz when the drive is available as /dev/sdz to see what attributes it has. An ATTR attribute matches the device itself; there is also ATTRS to match an attribute of a parent device (e.g. the bus to which a device is connected). Beware that you can only use ATTRS rules from a single section of the udevinfo input; in addition, you can use ATTR rules from the initial section. See [Understand output of udevadm info -a -n /dev/sdb](http://unix.stackexchange.com/questions/45791/understand-output-of-udevadm-info-a-n-dev-sdb for more background).

While you're at it, you might as well give more expressive names such as old-nas and new-nas.

share|improve this answer
    
Add a line or two about how to find those details? –  T.C. Jul 23 at 16:43
1  
@T.C. Good point, edited. –  Gilles Jul 23 at 18:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.