SCSIDEV(8)
π SCSIDEV π
okay bestie, welcome to SCSIDEV(8) β it lives in the System Manager's Manual section, and it's the girl who makes your /dev/scsi nodes stay put no matter how much you mess with your SCSI chain. iconic behaviour, honestly.
# $Id: scsidev.8,v 1.11.2.8 2004/02/18 10:08:59 garloff Exp $ #
β¨ NAME β¨
scsidev β populates /dev/scsi with device names that are persistent against SCSI configuration changes. π«
π SYNOPSIS π
scsidev [ -f ] [ -n ] [ -d ] [ -l ] [ -L ] [ -m mode ] [ -c mxms ] [ -A aliasfile ] [ -r ] [ -M ] [ -e ] [ -o ] [ -s ] [ -v ] [ -q ] [ -h ]
π¦ DESCRIPTION π¦
so like, scsidev is a utility that guarantees the same device node can be used for the same scsi device, no matter what other scsi devices get added or removed from the scsi chain. periodt.
why does this even need to exist, you ask? 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, because 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. not the vibe. π
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 an immutable name that will represent the device. it first checks to see if a node by this name already exists β if that's 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. so thoughtful of her. π«Ά
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 device 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. (more on those below, bestie, don't skip.)
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. no skipping, fr fr.
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. let's break it down like a group chat screenshot: π
- to begin with, the
h4indicates that it is connected to an Adaptec 1542. - the
-334is 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
c0represents the channel number (since some host adapters can drive multiple scsi busses). - the
i0l0indicates that this device is scsi ID 0, with lun 0. - finally the
p1indicated partition number 1.
π OPTIONS π
-fβ Flush everything from/dev/scsiprior to scanning the detected devices. this means that new device nodes will be created even if the old ones were OK. fresh start energy β¨-dβ Sanitize by deletion. the.shadow.backup files will not be created, so you loose all non-default ownership/permissions that may have been set. gone. poof. π-nβ Don't touch device nodes for non-existing SCSI devices. this might have security implications and is therefore not recommended. bestie. please.-lβ Symbolic link mode. instead of creating nodes, symbolic links are created which point to the older/dev/sda1types of device nodes. when using this option, the permissions of the/dev/XXXdevice nodes will be changed to match the ones stored in/dev/scsi/YYYfile, if present.-Lβ Use symbolic names for the aliases assigned through the/etc/scsi.aliassettings (see below). π-mmodeβ Specifies the mode (permissions) for new entries that need to be created.-cmaxmissβ Normally, ifscsidevfails to open a generic scsi device, it finishes its scan for devices. with this option, it goes on until maxmiss missing devices were found. this is only used if you don't have the/proc/scsi/scsiextensions for large disks.-Aaliasfileβ Use an alternative file instead of the default/etc/scsi.alias(see below).-rβscsidevdoes first probe the generic and then β if appropriate β the other highlevel devices (st,sd,sr). for removable devices (sd,sr,osst), this will fail if no medium is inserted, soscsidevcan not ensure that the device actually corresponds to the one reported by thesginterface. after the first device scan, the situation is clear andscsidevwill do the right guesses. so using-rin bootup scripts is safe. after you removed devices from your SCSI config, it isn't safe any longer. this is only needed if you don't have the/proc/scsi/scsiextensions for large disks.-Mβ Multipath support.scsidevnormally does complain if a line inscsi.aliasmatches more than one device and does not create an alias then. with multipath support on, it just creates the alias for the first device found matching the description in thescsi.aliasdescription.-eβ Instructsscsidevto use devfs like names, i.e. using thecbtu(controller, bus, target unit) characters instead ofhcil(host, channel, scsi Id, scsi Lun) to build the device name.-oβ Instructsscsidevto usescdinstead ofsrfor the old names of CD-ROM devices (relevant for symlink mode).-sβ Tellsscsidevto print out the device serial numbers of all detected devices on the system. this string can be useful for forming aliases. if supported, also the WWID is printed. so handy. π-vβ Verbosity. mainly used for debugging purposes. use multiple times for more verbosity.-qβ Be Quiet. only produce output if there are errors. π€«-hβ Output short usage summary and copyright info and exit.
πΈ ALIASES πΈ
it was intended that scsidev be useful without any configuration at all. but 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. main character names, honestly. π
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=cdwriter
the 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:
manufacturer=β Specifies the name of the manufacturer. this is the same string that is printed at boot time, and is also available through/proc/scsi.model=β Specifies the model number of the device. this is the same string that is printed at boot time, and is also available through/proc/scsi.rev=β Specifies the revision string of the device. this is the same string that is printed at boot time, and is also available through/proc/scsi.serial_number=β Specifies the serial number of the device. not all devices implement this, but for those that do it provides a convenient mechanism to uniquely identify a device no matter where it is found on the scsi chain. the serial number is the one reported in INQUIRY page0x80with EVPD=1. it is displayed byscsidev -s.wwid=β Specifies the WWID number of a device. this is a 64bit world wide unique number, which is supported by SCSI-3 devices and reported via INQUIRY page0x83with EVPD=1. if supported, it's displayed byscsidev -s.id=β Specifies the scsi id number for the device.lun=β Specifies the lun for the device. most devices have a lun of0, and it is only special devices such as cd changers that implement multiple lun devices.chan=β Specifies which channel (i.e. which bus) for host adapters that drive multiple channels.partition=β Specifies the partition number for disk drives. if unspecified, the alias will match all partitions on the disk.hostid=β Specifies the host adapter id number (the0x334part ofsdh4-334c0i0l0p1for example).hostnum=β Specifies the unique number that each host adpater driver returns. generally this number is always0except for cases where the driver supports more than one device of a given type on the system.hostname=β Specifies the host adapter driver name. (only the given chars need to match, so you may omit the version number.)
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. she's always thinking ahead. π«Ά
π AUTHOR π
scsidev
- ... was written by Eric Youngdale
<eric@aib.com> - ... was enhanced by Kurt Garloff
<garloff@suse.de>
π BUGS π
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. yeah. that one's on you, bestie.
π COPYRIGHT π
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 the /usr/share/common-licenses/GPL file.
β¨ hold up bestie, there's more of this page coming β don't close the tab π
π AVAILABILITY π
okay bestie so like. if you're sitting here like "omg where do i even GET this thing" β no worries, i gotchu π here's the tea:
http://www.suse.de/~garloff/linux/scsidev/β yes, fr fr, that's a real URL- and also
http://www.garloff.de/kurt/linux/scsidev/β same energy, different door πͺβ¨ - and it's gonna be put on the standard anonymous ftp servers too, so like. options, we love options π
and if you're feeling nostalgic (or just chaotic π¦), the old version is living its best vintage life over at:
ftp://tsx-11.mit.edu/pub/linux/BETA/scsi/
lowkey a whole time capsule, ngl π«Ά
and that's the whole page, bestie!! π this was Version 2.29, dated June 2003, and it lives in section SCSIDEV(8) β iconic of it, honestly πβ¨
go forth and mount things responsibly, my love πΈπ
π¦ where this page comes from
- debian bookworm: scsitools 0.12-4
- debian trixie: scsitools 0.12-6
- ubuntu jammy: scsitools 0.12-3ubuntu1
- ubuntu noble: scsitools 0.12-4ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms