[olug] Drive letter assignments

Luke-Jr luke at dashjr.org
Mon Apr 11 23:20:27 UTC 2011


On Sunday, April 10, 2011 10:39:03 pm Obi-Wan wrote:
> While I'm on the hard drive topic, it drives me crazy that every time
> I reboot my machine that contains five physical drives (one PATA, four
> SATA), the sdX drive letters get scrambled.  I label every partition,
> so this doesn't affect drive mounting, but it plays havoc with my
> MRTG setup because SNMP sorts its entries by drive letter (-ish).
> 
> Is there any way around this?  I only reboot once every few months to
> catch kernel updates, but it's still annoying.

I have a file in /etc/udev/rules.d:

SUBSYSTEM=="block", ATTRS{model}=="WDC WD2500BB-00D", SYMLINK+="hd2004a%n", ENV{GENERATED}="1"
SUBSYSTEM=="block", ATTRS{model}=="ST3500630AS     ", SYMLINK+="hd2007a%n", ENV{GENERATED}="1"
SUBSYSTEM=="block", ATTRS{model}=="SAMSUNG HD753LJ ", SYMLINK+="hd2008a%n", ENV{GENERATED}="1"
SUBSYSTEM=="block", ATTRS{model}=="WDC WD20EARS-00M", SYMLINK+="hd2011a%n", ENV{GENERATED}="1"

This generates symlinks /dev/hd2004a /dev/hd2007a /dev/hd2008a and /dev/hd2011a as well as 
/dev/hd2004a1 (for partition 1) etc. If I buy a second hard drive this year, it will be 
/dev/hd2001b... and I'll make sure it isn't the same model ;)



More information about the OLUG mailing list