[ltp] Reserving disk drive identities?

Tino Keitel linux-thinkpad@linux-thinkpad.org
Wed, 4 Jun 2003 19:41:52 +0200


On Wed, Jun 04, 2003 at 18:18:19 +0100, Richard Neill wrote:
> Dear All,
> 
> I wonder if anyone can help me here. I have 2 removable drives
> connected to my Thinkpad, one is a Firewire HDD, and the other is a
> compact flash card (an IBM microdrive) connected via a usb card
> reader. They all work OK, but...
> 
> Depending on which is plugged in, the order in which they are plugged 
> in, and the situation at power on, they both fight over which is 
> /dev/sda and which is /dev/sdb. They also mess up the scsi id of the
> CD writer (was 0,0,0, sometimes becomes 1,0,0). This makes mounting
> them a real nuisance - as I can't put the right entry in /etc/fstab.
> 
> Is there any way to "reserve a drive letter" like one can in Windows,
> such that I always predictably get the same physical device assigned
> to the same /dev/sdX ? Eg, I might have: Firewire HDD not plugged in;
> USB drive plugged in.
> 	=> /dev/sda reserved, /dev/sdb assigned to USB drive
> 
> I'm using Mandrake 9.1, which uses devfs. If anyone can help, or give
> me a pointer to the right howto, I'd be very grateful!

For the hard disks, you could use e2labels if you use ext2 or ext3.
Using tune2fs -L <name> /dev/sda1 (for example) you can give sda1 a
name. This name you can use in fstab like this:

LABEL=<name>       /mnt           ext3     defaults  1    1

This way, you don't need to mess around with device names.

Regards,
Tino