1SG_RESET(8) SG3_UTILS SG_RESET(8)
2
3
4
6 sg_reset - sends SCSI device, target, bus or host reset; or checks
7 reset state
8
10 sg_reset [--bus] [--device] [--help] [--host] [--no-esc] [--target]
11 [--verbose] [--version] DEVICE
12
14 The sg_reset utility with no options (just a DEVICE) reports on the
15 reset state (e.g. if a reset is underway) of the DEVICE. When given a
16 --device, --target, --bus or --host option it requests a device, tar‐
17 get, bus or host reset respectively.
18
19 A device reset is applied to the Logical Unit (LU) corresponding to
20 DEVICE. It is most likely implemented by a Low level Driver (LLD) in
21 Linux as a LOGICAL UNIT RESET task management function.
22
23 The ability to reset a SCSI target was added in Linux kernel 2.6.27 . A
24 LLD may send Low level Drivers (LLDs) the I_T NEXUS RESET task manage‐
25 ment function. Alternatively it may use a transport mechanism to do the
26 same thing (e.g. a hard reset on the link containing a SAS target).
27
28 In the Linux kernel 2.6 and 3 series this utility can be called on sd,
29 sr (cd/dvd), st or sg device nodes; if the user has appropriate permis‐
30 sions.
31
32 Users of this utility can check whether a reset recovery is already
33 underway before trying to send a new reset with this utility. Calling
34 this utility with no options, just the DEVICE, will do such a check.
35
37 -b, --bus
38 attempt a SCSI bus reset. A bus reset is a SCSI Parallel Inter‐
39 face (SPI) concept not found in modern transports. A recent LLD
40 may implement it as a series of resets on targets that might be
41 considered as siblings to the target on the DEVICE path.
42
43 -d, --device
44 attempt a SCSI device reset. This would typically involve send‐
45 ing a LOGICAL UNIT RESET task management function to DEVICE.
46
47 -z, --help
48 print the usage message then exit.
49
50 -H, --host
51 attempt a host reset. The "host" in this context is often called
52 a Host Bus Adapter (HBA) and contains one or more SCSI initia‐
53 tors.
54
55 -N, --no-esc
56 without this option, if a device reset (--device) fails then it
57 will escalate to a target reset. And if a target reset (--tar‐
58 get) fails then it will escalate to a bus reset. And if a bus
59 reset (--bus) fails then it will escalate to a host reset. With
60 this option only the requested reset is attempted. An alternate
61 option name of --no-escalate is also accepted.
62
63 --no-escalate
64 The same as -N, --no-esc.
65
66 -t, --target
67 attempt a SCSI target reset. A SCSI target contains one or more
68 LUs. This would typically involve sending a I_T NEXUS RESET task
69 management function to DEVICE There may be a transport action
70 that is equivalent (e.g. in SAS a hard reset on the link that
71 contains the target).
72
73 -v, --verbose
74 increase the degree of verbosity (debug messages).
75
76 -V, --version
77 prints the version string then exits.
78
80 The error recovery code within the Linux kernel (SCSI mid-level) when
81 faced with a SCSI command timing out and no response from the device
82 (LU) does the following. First it tries a device reset and if that is
83 not successful tries a target reset. If that is not successful it tries
84 a bus reset. If that is not successful it tries a host reset. The
85 "device,target,bus,host" order is the reset escalation that the --no-
86 esc option attempts to stop. In large storage configurations the esca‐
87 lation may be (very) undesirable.
88
89 This utility calls the SG_SCSI_RESET ioctl and as of lk 3.10.7 the
90 --no-esc option is not supported. Patches to implement this functional‐
91 ity may be accepted in lk 3.18 or 3.19 .
92
93 SAM-4 and 5 define a hard reset, a LOGICAL UNIT RESET and a I_T NEXUS
94 RESET. A hard reset is defined to be a power on condition, a microcode
95 change or a transport reset event. LOGICAL UNIT RESET and I_T NEXUS
96 RESET can be requested via task management functions (and support for
97 LOGICAL UNIT RESET is mandatory). In Linux the SCSI subsystem leaves it
98 up to the LLDs as to exactly what type (if any) of reset is performed.
99 The "bus reset" is SCSI Parallel Interface (SPI) concept that may not
100 map well to recent SCSI transports so it may be a dummy operation. A
101 "host reset" attempts to re-initialize the HBA that the request passes
102 through en route to the DEVICE. Note that a "host reset" and a "bus
103 reset" may cause collateral damage.
104
105 This utility does not allow individual SCSI commands to be aborted.
106 SAM-4 defines ABORT TASK and ABORT TASK SET task management functions
107 for that.
108
109 Prior to SAM-3 there was a TARGET RESET task management function. And
110 in SAM-4 I_T NEXUS RESET appeared which seems closely related: the
111 "I_T" stands for Initiator-Target.
112
113 Transports may have their own types of resets not supported by this
114 utility. For example SAS has a link reset in which both ends of a
115 physical link (e.g. between a SAS expander and a SAS tape drive) rene‐
116 gotiate their connection.
117
118 Prior to version 0.57 of this utility the command line had short
119 options only (e.g. -d but not --device). Also -h invoked a host reset
120 while in the current version -h is equivalent to --help and both -H and
121 --host invoke a host reset. For backward compatibility define the envi‐
122 ronment variable SG3_UTILS_OLD_OPTS or SG_RESET_OLD_OPTS . In this case
123 -h will invoke a host reset and the output will be verbose as it was
124 previously (equivalent to using the --verbose option now). For exam‐
125 ple:
126
127 SG_RESET_OLD_OPTS=1 sg_reset -h /dev/sg1
128 sg_reset: starting host reset
129 sg_reset: completed host reset
130
132 Since sg3_utils version 1.23 the environment variables
133 SG3_UTILS_OLD_OPTS or SG_RESET_OLD_OPTS can be given. When either is
134 present this utility will expect the older command line options as out‐
135 lined in the NOTES section.
136
138 Written by Douglas Gilbert.
139
141 Copyright © 1999-2017 Douglas Gilbert
142 This software is distributed under the GPL version 2. There is NO war‐
143 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
144 POSE.
145
146
147
148sg3_utils-1.43 October 2017 SG_RESET(8)