1Introduction 2------------ 3sdparm is a utility for listing and potentially changing SCSI disk 4parameters. More generally it can be used on any device that uses 5a SCSI command set. Apart form SCSI disks, examples of devices that 6use SCSI command sets are ATAPI CD/DVD drives, SCSI and ATAPI tape 7drives and SCSI enclosures. 8 9This utility was originally written for Linux. It has been ported 10to FreeBSD, Solaris, Tru64, and Windows. 11 12Relationship to sg3_utils 13------------------------- 14This package shares code with sg3_utils (version 1.25). With the 15subversion revision control system this is done by having sdparm's 16"include/" and "lib/" subdirectories pointing to the correspondingly 17named directories in the sg3_utils package using the "svn:externals" 18property. These two "external" directories include more files than 19sdparm uses. The excess files include "lib/Makefile.am" and 20"lib/Makefile.in". The "Makfile.am" in sdparm's "src/" directory does 21the main part of the build. When the tarball is generated for this 22utility, various files are "exported" out of the subversion repository 23and "svn:externals" redirection is no longer visible (but the unused 24files are visible). 25 26Currently the shared code is statically compiled into each package. 27It is the intention of the author to make a common library called 28libsgutils.so in a separate package that both sdparm and sg3_utils 29will depend on at some point in the future. 30 31Documentation 32------------- 33The executable outputs a usage message when the "--help" (or '-h' or '-?') 34option is given. Many syntax errors also result in the usage message being 35printed. There is also a man page which is in section 8 (administration 36and privileged commands). It can be accessed with "man sdparm" once this 37package is installed. Prior to installation the man page can be viewed 38from this package's main directory with "man doc/sdparm.8". 39 40There is a web page at http://www.torque.net/sg/sdparm.html and a copy 41of that html file is placed in the "doc" directory. 42 43Build infrastructure 44-------------------- 45This packages uses the automake and autoconf tools. The generating 46files (scripts) are configure.ac, Makefile.am, src/Makefile.am and 47autogen.sh . The autogen.sh script only needs to be executed if one of 48the other generating files in the above list is changed. 49 50There is a rpm "spec" file in the main directory: sdparm.spec . 51There are debian build files in the "debian" directory and a 52script called build_debian.sh in the main directory. 53 54License 55------- 56This utility is covered by a FreeBSD license. The intention of the author 57is that both open source and commercial entities can re-use this code. 58Naturally credit and improvement/bug feedback are encouraged. The part 59of this code that others may be able to re-use is the information in 60the tables in sdparm_data.c and sg_lib.c . This is information garnered 61from SCSI drafts and standards at http://www.t10.org (plus some 62information from the ATA drafts and standards at http://www.t13.org ). 63Vendor specific mode page information is found in the sdparm_data_vendor.c 64file and is derived from vendor product manuals. 65 66Notes 67----- 68More specific information about building this package can be found in 69the INSTALL file. The contents of COPYING is a FreeBSD license (rather 70than the GPL v2 found in the usual template). 71 72Linux port 73---------- 74The utility can be used on any device that supports the SG_IO ioctl. In 75the linux 2.4 series that is only the scsi generic (i.e. /dev/sg* ) 76device nodes. In the linux 2.6 series the supported device nodes has 77expanded to all other SCSI device nodes (e.g. /dev/sd* and /dev/sr*) 78plus block devices such as /dev/hdc when the associated device is a 79DVD drive. Most man page and www.torque.net/sg/sdparm.html web page 80examples use linux device node names. 81 82FreeBSD port 83------------ 84Virtually all of sdparm's features work with FreeBSD. SCSI commands are 85routed through the CAM pass through interface. The author tested sdparm 86with FreeBSD version 5.3 and found SCSI disks worked with the "da" device 87(e.g. 'sdparm /dev/da0'). SCSI tape drives can be accessed via the "sa" 88device via /dev nodes starting with "esa", "nsa" and "sa". To access cd/dvd 89drives, the kernel needs to be build with the "atapicam" device after which 90access is via the "cd" device. Other SCSI devices are "ses" (for enclosure 91services), "ch" (media changer (for tapes)), and "pr" for processor device 92type (e.g. SAF-TE devices). All these device may also be accessed via 93the "pass" device. To see the mapping between the "pass" device name and 94the corresponding higher level device node try "camcontrol devlist". 95 96Solaris port 97------------ 98Currently assumes gcc is present. 99 100 101Tru64 (osf) port 102---------------- 103?? 104 105 106Win32 port 107---------- 108This port only supports Windows NT, 2000, 2003 and XP (not 95, 98, ME or 109earlier). It uses the Microsoft SCSI Pass Through "Direct" (SPTD) rather 110than ASPI32 which requires a dll from Adaptec. 111 112The source can be built in a cygwin environment and can run in a cygwin 113bash shell. It can also run in a DOS shell if the cygwin1.dll is put in an 114appropriate place. 115Alternatively the source can be built with the MinGW compiler using its 116MSYS shell. This removes the dependence on the cygwin1.dll file. 117 118The device naming schemes attempt to follow what DOS does, with a few short 119cuts. If volume "D:" is an ATAPI DVD drive then the actual file opened 120is "\\.\D:". All device nodes of interest to sdparm have a leading "\\.\" 121so if the user doesn't supply it, sdparm will. Thus 'sdparm d:' should work. 122Note that volume names map to Windows partitions so there can be multiple 123volume names per disk. SCSI devices (or those that use a SCSI command set) 124can also be accessed via their "class" driver. These have names 125like "PhysicalDrive<n>", "CDROM<n>" and "TAPE<n>" where <n> is a number 126starting at 0. Since "PhysicalDrive" is tedious to type, a shortened 127form "PD" is accepted. So if "PD3" is a SCSI disk (or a SATA disk behind 128a SAT layer) then 'sdparm pd3' should work. 129 130Finally there is a lower level "SCSI<n>:" interface that addresses a SCSI 131adapter. The device needs further sub-addressing in the form of a bus 132number (also called a PathId), a target identifier and a lun (logical 133unit number). sdparm uses this notation: "SCSI<n>:<bus>,<target>,<lun>". 134The trailing ",<lun>" may be omitted in which case a lun of 0 is assumed. 135Once a device has been "claimed" by an upper level "class" driver the 136OS will not allow it to be accessed via the "SCSI<n>:" interface. Hence 137this is only needed for special devices (e.g. with processor or SES 138peripheral device type) that are not claimed by the class drivers. 139 140The '--wscan' (or '-w') option has been added to show the mapping between 141the volume name(s), class driver name and the "SCSI<n>:" name. It attempts 142to place all device names for the same device on the same line followed 143by its INQUIRY string. Unfortunately each USB or IEEE 1394 device may 144appear on two lines. Here is an example of the output: 145 146# sdparm -w 147SCSI0:0,0,0 C: PD0 IC25N040ATCS05-0 CS4O * 148SCSI1:0,0,0 D: CDROM0 HITACHI DVD-ROM GD-S200 0034 149SCSI2:0,0,0 I: + PD5 QUANTUM LPS525S 3110 150SCSI2:0,6,0 TAPE0 SONY SDT-7000 0192 151 E: Generic USB SD Reader 1.00 pdt=0 152 PD1 Generic USB SD Reader 1.00 153 154The last two lines are actually one device. The "*" at the end of 155the first line flags that the SCSI-2 INQUIRY response is not quite 156correct, usually indicative of an ATA disk. The "+" after the "I:" 157indicates that several volume names (letters) map to that device. 158That usually means there are two or more partitions which Windows 159recognizes. Devices for which no class device name is found 160(e.g. the column that starts with "PD0" above) have their SCSI 161"peripheral device type" (pdt) value placed at the end of the line. 162The longer "PhysicalDrive" name, shown in Windows documentation, 163may be used but "PD" is obviously quicker to type. 164 165 166Douglas Gilbert 1678th October 2007 168