[ltp] Reserving disk drive identities?

Robert Hajime Lanning linux-thinkpad@linux-thinkpad.org
Wed, 4 Jun 2003 10:38:27 -0700 (PDT)


<quote who="Richard Neill">
> 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!

There really is not a way to do what you want, the way you want.

What you would need to do is, not use fstab.  sda vs. sdb... is decided
upon by the kernel when enumerating the busses.  Then the question comes
up, "how do I distinguish between two (or more) firewire drives" (or USB).

The answer tends to be, "put a signature on the device".  This is how
alot of RAID systems handle drive shuffling.  AIX is very good at this.

So, if you have all your removable drives partitioned with just a single
partition, then you could put a ".mount-as" file in the root.

So, then you would have a script that mounts the drive on a temporary
mount point, reads the file, then umounts it.  Then mounts it in the
proper place.

Of course, you can get complicated and put the info in, say, the MBR.
(if you are not making these drives bootable.)  Then you can "dd" the
first 512 bytes and parse that.  (RAID systems do it more like that.)

-- 
END OF LINE