SCSIDEV(8) | System Manager's Manual | SCSIDEV(8) |
scsidev - populate /dev/scsi with device names that are persistent against SCSI configuration changes.
scsidev [ -f ] [ -n ] [ -d ] [ -l ] [ -L ] [ -m mode ] [ -c mxms ] [ -A aliasfile ] [ -r ] [ -M ] [ -e ] [ -o ] [ -s ] [ -v ] [ -q ] [ -h ]
scsidev is a utility that is used to guarantee that the same device node can be used for the same scsi device, no matter what other scsi devices are added or removed from the scsi chain. The need for this tool arose because device numbers are assigned dynamically at boot time, and if a new disk were added to the system (or if some disk didn't spin up), then fixed device nodes would cause the wrong filesystems to be mounted, checked, etc. This can also result in security holes, as some device nodes may have permissions that allow general users access to the raw device, and if the mappings were to change, users would be able to access different devices.
scsidev is designed to be used once each time the system boots. It will scan all of the detected devices on the system, and determine a immutable name that will represent the device. It first checks to see if a node by this name already exists - if this is the case, then it checks to see if the major/minor numbers are correct. If a change in the minor number is required, then a new device is created with the correct major/minor numbers, and in addition, any ownership and permissions for the old device are applied to the new device.
Once this process is complete, then scsidev will scan all of the entries in the /dev/scsi directory, and see if any of them are for devices nodes which were added for devices that are not active. The permissions of inactive devices are stored in a .shadow. file and the device node is removed as a security precaution, since these might have permissions that would allow people to access devices that they should not be able to access. This is the default behaviour and is considered ideal for most cases, as it preserves the ownership and permissions of the files and is secure.
The so called sanitizing can be influenced by the options -f -d -n.
When you rescan the bus by using the rescan-scsi-bus.sh script or manually by using commands like
echo "scsi add-single-device C B T U" >/proc/scsi/scsi(C = Controller (host) no., B = Bus (Channel), T = Target (SCSI ID), U = Unit (SCSI LUN)) after the system is booted, then you will have to rerun scsidev so that the device nodes for the newly detected devices are properly updated.
The device nodes that scsidev creates look something like "sdh4-334c0i0l0p1". In this case, the various components of the name represent physical attributes about the device or the host adapter to which it is connected. To begin with, the "h4" indicates that it is connected to an Adaptec 1542. The "-334" is a means of identifying which 1542 the device is attached to (since linux supports more than one 1542 in the system at the same time) and (in this case) corresponds to the IO Port number (hex) of the controller (this is the host adapter id number). The "c0" represents the channel number (since some host adapters can drive multiple scsi busses). The "i0l0" indicates that this device is scsi ID 0, with lun 0. Finally the "p1" indicated partition number 1.
It was intended that scsidev be useful without any configuration at all. There are times when it is much more convenient to have symbolic names for various devices. These symbolic names should track devices as they get moved from controller to another, or even if the SCSI id number is changed.
The general idea is that there is a configuration file /etc/scsi.alias which lists the aliases that scsidev will attempt to create. Each line represents a separate alias, and consists of a series of tokens. Here are a couple of example entries:
serial_number="DX908FK", devtype=disk, alias=fourgig manufacturer=WANGTEK, devtype=tape, alias=qictape id=2, devtype=generic, alias=cdwriterThe minimum requirements are that each line have a alias and a devtype field. The alias will be used to build the pathnames, and the devtype must be one of disk, tape, osst, cdrom or generic.
The additional qualifiers are optional, and you must specify a sufficient number of them such that the alias will match only one device. The allowable qualifiers are:
Note that the specifiers which take string arguments can be quoted if the string contains whitespace.
For disks, aliases for all partitions will be created (unless partition= is specified). The names get a -pN suffix (N indicating the number of the partition. For tapes (st and osst type), the non-rewinding variant with an n prepended will be created automatically.
scsidev
... was written by Eric Youngdale <eric@aib.com>
... was enhanced by Kurt Garloff <garloff@suse.de>
Probably there are ...
The BIOS and LILO do not have the knowledge about the SCSI devices at boot time, so you still have to ensure, your kernel can be loaded when you insert a new disk.
This program is free software. You can use it under the terms of the GNU GPL (General Public License) Version 2 (or any later version, at your option). Note, that the GNU GPL implies, that there is NO WARRANTY at all. Full text of the GPL can be found in /usr/share/common-licenses/GPL file.
scsidev is available from
http://www.suse.de/~garloff/linux/scsidev/ and http://www.garloff.de/kurt/linux/scsidev/ and will also be put on standard anonymous ftp servers. The old version is available from ftp://tsx-11.mit.edu/pub/linux/BETA/scsi/
June 2003 | Version 2.29 |