1SG_START(8) SG3_UTILS SG_START(8)
2
3
4
6 sg_start - send SCSI START STOP UNIT command: start, stop, load or
7 eject medium
8
10 sg_start [0] [1] [--eject] [--help] [--fl=FL] [--immed] [--load]
11 [--loej] [--mod=PC_MOD] [--noflush] [--pc=PC] [--readonly] [--start]
12 [--stop] [--verbose] [--version] DEVICE
13
14 sg_start [--eject] [--fl=FL] [-i] [--imm=0|1] [--load] [--loej]
15 [--mod=PC_MOD] [--noflush] [--pc=PC] [-r] [--start] [--stop] [-v] [-V]
16 [0|1] DEVICE
17
19 sg_start sends a SCSI START STOP UNIT command to the DEVICE with the
20 selected options. The most used options are --stop to spin down a disk
21 and --start to spin up a disk. Using --start on a disk that is already
22 spinning is harmless. There is also finer grain control with "power
23 condition": active, idle or standby. This is set with the --pc=PC op‐
24 tion. In some contexts the "stop" state can be considered an additional
25 power condition.
26
27 Devices that contain removable media such as cd/dvds can use the --loej
28 option to load the medium when used in conjunction with --start (i.e.
29 load medium then spin up). Alternatively --loej may be used to eject
30 the medium when used in conjunction with --stop (i.e. spin down then
31 eject medium). More simply, the loading or ejecting of a removable
32 medium can be requested with the --load or --eject' option.
33
34 If no option or argument is given then a --start is assumed; as the
35 utility's name suggests.
36
37 This utility supports two command line syntaxes, the preferred one is
38 shown first in the synopsis and explained in this section. A later sec‐
39 tion on the old command line syntax outlines the second group of op‐
40 tions.
41
43 Arguments to long options are mandatory for short options as well.
44
45 0 same action as --stop.
46
47 1 same action as --start.
48
49 -e, --eject
50 stop the medium and eject it from the drive. Only appropriate
51 for a device with removable medium. Might be ignored (pre‐
52 vented), see below.
53
54 -h, --help
55 print out the usage message then exit.
56
57 -f, --fl=FL
58 sets the format layer number for the disc to "jump" to (defined
59 in MMC-5). Values of FL can be 0 to 3. When this option is cho‐
60 sen, the FL, LoEj and Start bits are set in the cdb as required
61 by MMC-5; thus the user does not need to set the --start and/or
62 --load options.
63
64 -i, --immed
65 sets the IMM bit on the START STOP UNIT command so this utility
66 will return immediately and not wait for the media to complete
67 the requested action. The default is to wait until the media to
68 complete the requested action before returning.
69
70 -l, --load
71 load the medium in the drive and start it. Only appropriate for
72 a removable medium.
73
74 -L, --loej
75 sets the LOEJ bit on the START STOP UNIT command. This loads the
76 media when the unit is started or eject it when the unit is
77 stopped (i.e. works in conjunction with START bit in cdb). This
78 option is ignored if 'pc > 0'. Default is off (i.e. don't at‐
79 tempt to load or eject media). If a start/start indication is
80 not given (i.e. neither --start nor --stop) and this option is
81 given then a load and start action is assumed.
82
83 -m, --mod=PC_MOD
84 where PC_MOD is the 'power condition modifier' value. 0 to 15
85 (inclusive) are valid and 0 is the default. This 'power condi‐
86 tion modifier' field in the cdb was added after sbc3r13.
87
88 -n, --noflush
89 do not perform a flush to media (e.g. like SYNCHRONIZE CACHE
90 does) before a variant of this utility that limits access to the
91 media. Using the --stop option is an example of something that
92 limits access to the media. This 'noflush' field in the cdb was
93 added after sbc3r13.
94
95 -O, --old
96 Switch to older style options. Please use as first option.
97
98 -p, --pc=PC
99 where PC is the 'power conditions' value. 0 to 15 (inclusive)
100 are valid. Default value is 0. When '--pc=0' then --eject,
101 --load, --loej, --start and --stop are active. Some common val‐
102 ues are 1 for the "active" power condition (SBC); 2 for the idle
103 power condition; 3 for the standby power condition; 5 for sleep
104 power condition (MMC); 7 for LU_CONTROL (SBC), 0xa (decimal 10)
105 for FORCE_IDLE_0 (SBC) and 0xb (decimal 11) for FORCE_STANDBY_0
106 (SBC). See recent SBC-3, MMC-5 and SAS drafts at www.t10.org for
107 more information.
108
109 -r, --readonly
110 open the DEVICE in read-only mode. Maybe required in Linux to
111 stop a nuisance spin-up if the DEVICE is an ATA disk. The nui‐
112 sance spin-up may occur at the end of this command negating the
113 effect of the --stop option.
114
115 -s, --start
116 start (spin-up) the DEVICE. This sets the START bit in the cdb.
117 Using this option on an already started device is harmless. In
118 the absence of other options, this option defaults (i.e. set the
119 START cdb bit).
120
121 -S, --stop
122 stop (spin-down) the DEVICE. This clears the START bit in the
123 cdb.
124
125 -v, --verbose
126 increase the level of verbosity. Can be used multiple times.
127
128 -V, --version
129 print out version string then exit.
130
132 To avoid confusion, only one of 0, 1 --eject, --load, --start and
133 --stop should be given.
134
135 There is an associated "power condition" mode page (0x1a) in which
136 timer values can be set for transitioning to either idle or standby
137 state after a period of inactivity. The sdparm utility can be used to
138 view the power condition mode page and if required change it. If a DE‐
139 VICE is in either idle or standby power condition state then a REQUEST
140 SENSE command (see the sg_requests utility) should yield a sense key of
141 "no sense" and an additional sense code of "Low power condition on" on
142 recent SCSI devices.
143
144 Ejection of removable media (e.g. 'sg_start --eject /dev/hdd' where the
145 DEVICE is an ATAPI cd/dvd drive) may be prevented by a prior SCSI PRE‐
146 VENT ALLOW MEDIUM REMOVAL command (see sg_prevent). In this case this
147 utility should fail with an error generated by the device: illegal re‐
148 quest / medium removal prevented. This can be overridden using sg_pre‐
149 vent or, for example, 'sdparm --command=unlock /dev/hdd'.
150
151 The SCSI TEST UNIT READY command can be used to find out whether a DE‐
152 VICE is ready to transfer data. If rotating media is stopped or still
153 coming up to speed, then the TEST UNIT READY command will yield a "not
154 ready" sense key and an more informative additional sense code. See the
155 sg_turs utility.
156
157 In the 2.4 series of Linux kernels the DEVICE must be a SCSI generic
158 (sg) device. In the 2.6 series block devices (e.g. SCSI disks and DVD
159 drives) can also be specified. For example "sg_start 0 /dev/sda" will
160 work in the 2.6 series kernels.
161
162 In the Linux 2.6 series, especially with ATA disks, using this utility
163 to stop (spin down) a disk may not be sufficient and other mechanisms
164 will start the disk again some time later. The user might additionally
165 mark the disk as "offline" with 'echo offline > /sys/block/sda/de‐
166 vice/state' where sda is the block name of the disk. To restart the
167 disk "offline" can be replaced with "running". Note that once the
168 'state' is set to offline, no SCSI commands can be sent to the device
169 until it is set back to running. Also stopping a disk via a
170 pass-through interface (e.g. /dev/sg1 or /dev/bsg/1:0:0:0) may reduce
171 unwanted side effects (such as restarting it again when this utility
172 completes).
173
175 The exit status of sg_start is 0 when it is successful. Otherwise see
176 the sg3_utils(8) man page.
177
179 The options in this section were the only ones available prior to
180 sg3_utils version 1.23 . Since then this utility defaults to the newer
181 command line options which can be overridden by using --old (or -O) as
182 the first option. See the ENVIRONMENT VARIABLES section for another way
183 to force the use of these older command line options.
184
185 Note that the action of --loej is slightly different in the older in‐
186 terface: when neither --start nor --stop (nor proxies for them) are
187 given, --loej performs an eject operation. In the same situation the
188 newer interface will perform a load operation.
189
190 Earlier versions of sg_start had a '-s' option to perform a SYNCHRONIZE
191 CACHE command before the START STOP UNIT command was issued. According
192 to recent SBC-2 drafts this is done implicitly if required. Hence the
193 '-s' option has been dropped.
194
195 All options, other than '-v' and '-V', can be given with a single "-".
196 For example: "sg_start -stop /dev/sda" and "sg_start --stop /dev/sda"
197 are equivalent. The single "-" form is for backward compatibility.
198
199 0 stop (spin-down) DEVICE.
200
201 1 start (spin-up) DEVICE.
202
203 --eject
204 stop the medium and eject it from the drive.
205
206 --fl=FL
207 sets the format layer number for the disc to "jump" to (defined
208 in MMC-5).
209
210 -i sets the IMM bit on the START STOP UNIT command so this utility
211 will return immediately and not wait for the media to spin down.
212 Same effect as '--imm=1'. The default action (without this op‐
213 tion or a '--imm=1' option) is to wait until the media spins
214 down before returning.
215
216 --imm=0|1
217 when the immediate bit is 1 then this utility returns immedi‐
218 ately after the DEVICE has received the command. When this op‐
219 tion is 0 (the default) then the utility returns once the com‐
220 mand has completed its action (i.e. it waits until the device is
221 started or stopped).
222
223 --load load the medium in the drive and start it.
224
225 --loej sets the LOEJ bit in the START STOP UNIT cdb. When a "start" op‐
226 eration is indicated, then a load and start is performed. When a
227 "stop" operation is indicated, then a stop and eject is per‐
228 formed. When neither a "start" or "stop" operation is indicated
229 does a stop and eject. [Note that the last action differs from
230 the new interface in which the option of this name defaults to
231 load and start.]
232
233 -N, --new
234 Switch to the newer style options.
235
236 --mod=PC_MOD
237 where PC_MOD is the 'power condition modifier' value. 0 to 15
238 (inclusive) are valid and 0 is the default. This field was added
239 after sbc3r13.
240
241 --noflush
242 do not perform a flush to media (e.g. like SYNCHRONIZE CACHE
243 does) before a variant of this utility that limits access to the
244 media. Using the --stop option is an example of something that
245 limits access to the media. This field was added after sbc3r13.
246
247 --pc=PC
248 where PC is the 'power condition' value (in hex). 0 to f (inclu‐
249 sive) are valid. Default value is 0.
250
251 -r see the --readonly option above. May be useful for ATA disks.
252
253 --start
254 start (spin-up) DEVICE.
255
256 --stop stop (spin-down) DEVICE. Same meaning as "0" argument.
257
258 -v verbose: outputs SCSI command in hex to console before with exe‐
259 cuting it. '-vv' and '-vvv' are also accepted yielding greater
260 verbosity.
261
262 -V print out version string then exit.
263
265 Since sg3_utils version 1.23 the environment variable
266 SG3_UTILS_OLD_OPTS can be given. When it is present this utility will
267 expect the older command line options. So the presence of this environ‐
268 ment variable is equivalent to using --old (or -O) as the first command
269 line option.
270
272 Written by K. Garloff and D. Gilbert
273
275 Report bugs to <dgilbert at interlog dot com>.
276
278 Copyright © 2002-2020 Kurt Garloff, Douglas Gilbert
279 This software is distributed under the GPL version 2. There is NO war‐
280 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
281 POSE.
282
284 sg_prevent(sg3_utils), sg_requests(sg3_utils), sg_turs(sg3_utils) sd‐
285 parm(sdparm)
286
287
288
289sg3_utils-1.43 September 2020 SG_START(8)