1.\" $NetBSD: scsictl.8,v 1.22 2005/01/07 02:13:13 wiz Exp $ 2.\" 3.\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8.\" NASA Ames Research Center. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. All advertising materials mentioning features or use of this software 19.\" must display the following acknowledgement: 20.\" This product includes software developed by the NetBSD 21.\" Foundation, Inc. and its contributors. 22.\" 4. Neither the name of The NetBSD Foundation nor the names of its 23.\" contributors may be used to endorse or promote products derived 24.\" from this software without specific prior written permission. 25.\" 26.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36.\" POSSIBILITY OF SUCH DAMAGE. 37.\" 38.Dd December 31, 2004 39.Dt SCSICTL 8 40.Os 41.Sh NAME 42.Nm scsictl 43.Nd a program to manipulate SCSI devices and busses 44.Sh SYNOPSIS 45.Nm 46.Ar device 47.Ar command 48.Oo 49.Ar arg Oo ... 50.Oc 51.Oc 52.Sh DESCRIPTION 53.Nm 54allows a user or system administrator to issue commands to and otherwise 55control SCSI devices and busses. 56It is used by specifying a device or bus to manipulate, 57the command to perform, and any arguments the command may require. 58.Nm 59determines if the specified device is an actual device or a SCSI bus 60automatically, and selects the appropriate command set. 61.Pp 62For commands which 63.Nm 64issues a SCSI command to the device directly, any returned sense information 65will be decoded by 66.Nm 67and displayed to the standard output. 68.Sh DEVICE COMMANDS 69The following commands are supported for SCSI devices: 70.Pp 71.Nm defects 72.Op primary 73.Op grown 74.Op block|byte|physical 75.Pp 76Read the primary and/or grown defect lists from the specified device 77in block, byte from index, or physical sector format. 78The default is to return both the primary and grown defect lists 79in physical sector format. 80This command is only supported on direct access devices. 81.Pp 82.Nm format 83.Oo blocksize 84.Oo immediate 85.Oc 86.Oc 87.Pp 88(Low level) format the named device. 89If the optional 90.Li blocksize 91parameter is provided, the device geometry will be modified to 92use the specified 93.Li blocksize . 94If this parameter is different form the Current or Default Mode Page 3 95parameters, the device will update Mode Page 3 at the successful 96completion of the Format. 97Device geometry may change as a result of using a new device 98.Li blocksize . 99When the optional 100.Li blocksize 101parameter is specified, the Defect List on the drive will revert to 102the original primary defect list created at the time of manufacture 103if available. 104The drive will usually recertify itself during the Format 105and add any other defective blocks to the new Defect List. 106Some disks may not support the ability to change the blocksize and 107may enter a Degraded Mode when fed a Format command of this type. 108If this happens the standard recovery for the drive requires issuing 109a correct Format command, i.e. one without the blocksize parameter. 110.Pp 111When the 112.Li immediate 113parameter is also specified, the disk is instructed to return from the 114format command right away. 115It continues to format, and every ten seconds 116.Nm 117issues a TEST UNIT READY command to check the associated sense data. 118This associated sense data has a progress indicator which indicates 119how far the format is progressing. 120Note well that most SCSI disk drives prior to 121a few years ago do not support this option. 122.Pp 123.Nm identify 124.Pp 125Identify the specified device, displaying the device's SCSI 126bus, target, and lun, as well as the device's vendor, product, 127and revision strings. 128.Pp 129.Nm reassign 130.Ar blkno 131.Oo blkno Oo ... 132.Oc 133.Oc 134.Pp 135Issues a 136.Li REASSIGN BLOCKS 137command to the device, adding the specified blocks to the 138grown defect list. 139This command is only supported on direct access devices. 140.Pp 141.Nm release 142.Pp 143Send a 144.Dq RELEASE 145command to the device to release a reservation on it. 146.Pp 147.Nm reserve 148.Pp 149Send a 150.Dq RESERVE 151command to the device to place a reservation on it. 152.Pp 153.Nm reset 154.Pp 155Reset the device. 156This command is only supported for devices which support the 157.Li SCIOCRESET 158ioctl. 159.Pp 160.Nm start 161.Pp 162Send a 163.Dq START 164command to the device. 165This is useful typically only for disk devices. 166.Pp 167.Nm stop 168.Pp 169Send a 170.Dq STOP 171command to the device. 172This is useful typically only for disk devices. 173.Pp 174.Nm tur 175.Pp 176Send a 177.Dq TEST UNIT READY 178command to the device. 179This is useful for generating current device status. 180.Pp 181.Nm getcache 182.Pp 183Returns basic cache parameters for the device. 184.Pp 185.Nm setcache 186.Ar none|r|w|rw 187.Op Ar save 188.Pp 189Set basic cache parameters for the device. 190The cache may be disabled 191.Pq none , 192the read cache enabled 193.Pq r , 194the write cache enabled 195.Pq w , 196or both read and write cache enabled 197.Pq rw . 198If the drive's cache parameters are savable, specifying 199.Ar save 200after the cache enable state will cause the parameters to be saved in 201non-volatile storage. 202.Pp 203.Nm flushcache 204.Pp 205Explicitly flushes the write cache. 206.Sh BUS COMMANDS 207The following commands are supported for SCSI busses: 208.Pp 209.Nm reset 210.Pp 211Reset the SCSI bus. 212This command is only supported if the host adapter supports the 213.Li SCBUSIORESET 214ioctl. 215.Pp 216.Nm scan 217.Ar target 218.Ar lun 219.Pp 220Scan the SCSI bus for devices. 221This is useful if a device was not connected or powered 222on when the system was booted. 223The 224.Ar target 225and 226.Ar lun 227arguments specify which SCSI target and lun on the bus is to be scanned. 228Either may be wildcarded by specifying the keyword 229.Dq any 230or 231.Dq all . 232.Pp 233.Nm detach 234.Ar target 235.Ar lun 236.Pp 237Detach the specified device from the bus. 238Useful if a device is powered down after use. 239The 240.Ar target 241and 242.Ar lun 243arguments have the same meaning as for the 244.Nm scan 245command, and may also be wildcarded. 246.Sh NOTES 247When scanning the SCSI bus, information about newly recognized devices 248is printed to console. 249No information is printed for already probed devices. 250.Sh FILES 251.Pa /dev/scsibus* 252- for commands operating on SCSI busses 253.Sh SEE ALSO 254.Xr ioctl 2 , 255.Xr cd 4 , 256.Xr ch 4 , 257.Xr sd 4 , 258.Xr se 4 , 259.Xr ss 4 , 260.Xr st 4 , 261.Xr uk 4 , 262.Xr atactl 8 , 263.Xr dkctl 8 264.Sh HISTORY 265The 266.Nm 267command first appeared in 268.Nx 1.4 . 269.Sh AUTHORS 270The 271.Nm 272command was written by Jason R. Thorpe of the Numerical Aerospace Simulation 273Facility, NASA Ames Research Center. 274