				scsimap Kit

		Copyright (c) 2001 Compaq Computer Corporation 
		Copyright (c) 1999 D. Gilbert
			 All Rights Reserved

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

-------------------------------------------------------------------------------

This program is a quick and dirty attempt to work around the problem
of scsi disk device nodes moving around due to, for example fibre
attached nodes joining an FCAL in different orders.

It works by doing a SCSI inquiry to get mode page 80 (serial number)
for each device /dev/sd*, then compares a canonical list of devices
names against this current list to re-establish a correct mapping.

To use this set of utilities do the following:

Step 1: make

Step 2: make install
	(must be root)
	This will put "scsi_serialno", "scsimap", and "scsiremap"
	into /usr/local/bin

Step 3:	Create a set of canonical symbolic links to the device nodes
	for which you wish to maintain a consistent mapping:

	e.g.:

	ln -s /dev/cciss/c0d0p6 /dev/mydisk1
	ln -s /dev/cciss/c0d0p5 /dev/mydisk2
	ln -s /dev/cciss/c0d0p2 /dev/mydisk3
	ln -s /dev/cciss/c0d0p1 /dev/mydisk4
	ln -s /dev/sda2 /dev/mydisk5 
	ln -s /dev/sda1 /dev/mydisk6 
	ln -s /dev/sda3 /dev/mydisk7 

Step 4: Record the canonical mapping:

	/usr/local/bin/scsimap /dev/mydisk* > /etc/scsimap.canonical
	
	The scsimap.canonical file will look something like:

/dev/mydisk1:6:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/mydisk2:5:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/mydisk3:2:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/mydisk4:1:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/mydisk5:2:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030
/dev/mydisk6:1:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030
/dev/mydisk7:3:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030

	The first number after the first colon is the device minor number
	(the partition number, essentially) and the part after the second 
	colon is the unique identifier (serial number) represented in hexadecimal. 

Step 5: Invoke "/usr/local/bin/scsiremap" from a convenient rc script.
	(should be prior to the time when those partitions are needed
	by applications such as "mount".)

	scsiremap will create /etc/scsimap.current, which would look
	something like this:

/dev/sda:0:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030
/dev/sda1:1:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030
/dev/sda2:2:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030
/dev/sda3:3:    COMPAQ  BB00911CA0      3B070080001433414c313439344630303030
/dev/cciss/c0d0p1:1:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/cciss/c0d0p2:2:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/cciss/c0d0p5:5:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004
/dev/cciss/c0d0p6:6:    COMPAQ  LOGICAL VOLUME  1.16 0c83001001000004a00ed5f101000004

	Then it will recreate the symbolic links listed in 
	/etc/scsimap.canonical such that they map to the
	correct /dev/cciss/c*d*p* or /dev/sd* device nodes
	according to the unique identifiers.

