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
24 option. In some contexts the "stop" state can be considered an addi‐
25 tional 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
40 options.
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
79 attempt 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.
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
139 DEVICE is in either idle or standby power condition state then a
140 REQUEST SENSE command (see the sg_requests utility) should yield a
141 sense key of "no sense" and an additional sense code of "Low power con‐
142 dition on" on 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
148 request / medium removal prevented. This can be overridden using
149 sg_prevent or, for example, 'sdparm --command=unlock /dev/hdd'.
150
151 The SCSI TEST UNIT READY command can be used to find out whether a
152 DEVICE 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 >
166 /sys/block/sda/device/state' where sda is the block name of the disk.
167 To restart the disk "offline" can be replaced with "running". Note that
168 once the 'state' is set to offline, no SCSI commands can be sent to the
169 device 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 . In sg3_utils version 1.23 and later these
181 older options can be selected by either setting the SG3_UTILS_OLD_OPTS
182 environment variable or using '--old' (or '-O) as the first option.
183
184 Note that the action of --loej is slightly different in the older
185 interface: when neither --start nor --stop (nor proxies for them) are
186 given, --loej performs an eject operation. In the same situation the
187 newer interface will perform a load operation.
188
189 Earlier versions of sg_start had a '-s' option to perform a SYNCHRONIZE
190 CACHE command before the START STOP UNIT command was issued. According
191 to recent SBC-2 drafts this is done implicitly if required. Hence the
192 '-s' option has been dropped.
193
194 All options, other than '-v' and '-V', can be given with a single "-".
195 For example: "sg_start -stop /dev/sda" and "sg_start --stop /dev/sda"
196 are equivalent. The single "-" form is for backward compatibility.
197
198 0 stop (spin-down) DEVICE.
199
200 1 start (spin-up) DEVICE.
201
202 --eject
203 stop the medium and eject it from the drive.
204
205 --fl=FL
206 sets the format layer number for the disc to "jump" to (defined
207 in MMC-5).
208
209 -i sets the IMM bit on the START STOP UNIT command so this utility
210 will return immediately and not wait for the media to spin down.
211 Same effect as '--imm=1'. The default action (without this
212 option or a '--imm=1' option) is to wait until the media spins
213 down before returning.
214
215 --imm=0|1
216 when the immediate bit is 1 then this utility returns immedi‐
217 ately after the DEVICE has received the command. When this
218 option is 0 (the default) then the utility returns once the com‐
219 mand has completed its action (i.e. it waits until the device is
220 started or stopped).
221
222 --load load the medium in the drive and start it.
223
224 --loej sets the LOEJ bit in the START STOP UNIT cdb. When a "start"
225 operation is indicated, then a load and start is performed. When
226 a "stop" operation is indicated, then a stop and eject is per‐
227 formed. When neither a "start" or "stop" operation is indicated
228 does a stop and eject. [Note that the last action differs from
229 the new interface in which the option of this name defaults to
230 load and start.]
231
232 -N switch to the newer style options.
233
234 --mod=PC_MOD
235 where PC_MOD is the 'power condition modifier' value. 0 to 15
236 (inclusive) are valid and 0 is the default. This field was added
237 after sbc3r13.
238
239 --noflush
240 do not perform a flush to media (e.g. like SYNCHRONIZE CACHE
241 does) before a variant of this utility that limits access to the
242 media. Using the --stop option is an example of something that
243 limits access to the media. This field was added after sbc3r13.
244
245 --pc=PC
246 where PC is the 'power condition' value (in hex). 0 to f (inclu‐
247 sive) are valid. Default value is 0.
248
249 -r see the --readonly option above. May be useful for ATA disks.
250
251 --start
252 start (spin-up) DEVICE.
253
254 --stop stop (spin-down) DEVICE. Same meaning as "0" argument.
255
256 -v verbose: outputs SCSI command in hex to console before with exe‐
257 cuting it. '-vv' and '-vvv' are also accepted yielding greater
258 verbosity.
259
260 -V print out version string then exit.
261
263 Written by K. Garloff and D. Gilbert
264
266 Report bugs to <dgilbert at interlog dot com>.
267
269 Copyright © 2002-2012 Kurt Garloff, Douglas Gilbert
270 This software is distributed under the GPL version 2. There is NO war‐
271 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
272 POSE.
273
275 sg_prevent(sg3_utils), sg_requests(sg3_utils), sg_turs(sg3_utils)
276 sdparm(sdparm)
277
278
279
280sg3_utils-1.35 November 2012 SG_START(8)