aboutsummaryrefslogtreecommitdiff
path: root/sg_start.8
blob: 27b55cf6d1ff3557daddce258d3fc9c912e1ae7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.TH SG_START "8" "April 2006" "sg3_utils-1.20" SG3_UTILS
.SH NAME
sg_start \- starts (spins-up) or stops (spins down) device, load or
eject medium
.SH SYNOPSIS
.B sg_start
[\fI--eject\fR] [\fI--fl=<n>\fR] [\fI-i\fR] [\fI--imm=0|1\fR] [\fI--load\fR]
[\fI--loej\fR] [\fI--pc=<n>\fR] [\fI--start\fR] [\fI--stop\fR] [\fI-v\fR]
[\fI-V\fR] [\fI0|1\fR] \fI<device>\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
sg_start sends a START STOP UNIT SCSI command to the given device with
the selected options. The most used options are '--stop' to spin down a disk
and '--start' to spin up a disk. Using 'sg_start --start /dev/sda' on a disk
that is already spinning is harmless. There is also finer grain control
with "power conditions": active, idle and standby. In some contexts
the "stop" state can be considered an additional power condition. 
.PP
Devices that contain removable media such as cd/dvds can use the '--loej'
flag to load the medium when used in conjunction with '--start' (i.e. load
medium then spin up). Alternatively '--loej' may be used to eject the medium
when used alone or when used in conjunction with '--stop' (i.e. spin down
then eject medium). More simply the loading and ejecting of a removable 
medium can be requested with the '--load' and '--eject' options.
.PP
If no option or argument is given then a '--start' is assumed; as the
utility's name suggests.
.TP
0
stop (spin-down) given device.
Active when '--pc=" is not given or '--pc=0'.
.TP
1
start (spin-up) given device.
Active when '--pc=" is not given or '--pc=0'. Harmless if device has
already started (or is in the process of starting).
.TP
--eject
stop the medium and eject it from the drive. Only appropriate for a
device with removable medium. Might be ignored (prevented), see below.
.TP
--fl=<n>
sets the format layer number for the disc to "jump" to (defined in
MMC-5). Values of '<n>' can be 0 to 3. When this option is chosen,
the FL, LoEj and Start bits are set in the cdb as required by MMC-5; thus
the user does not need to set the '--start' and/or '--load' options. 
.TP
-i
sets the IMM bit on the START STOP UNIT command so this utility will
return immediately and not wait for the media to spin down. Same
effect as '--imm=1'. The default action (without this option or
a '--imm=1' option) is to wait until the media spins down before
returning.
.TP
--imm=0|1
when the immediate bit is 1 then this utility returns immediately after
the device has received the command. When this option is 0 (the default)
then the utility returns once the command has completed its action
(i.e. it waits until the device is started or stopped).
.TP
--load
load the medium in the drive and start it. Only appropriate for a
removable medium.
.TP
--loej
load the media when the unit is started or eject it when the unit is
stopped. This option is ignored if 'pc > 0'. Default is off (i.e. don't
attempt to load or eject media). If a start/start indication is not
given (neither "--start" nor "--stop") and this option is given then a
stop and eject action is assumed.
.TP
--pc=<n>
set the 'power conditions' value (in hex); 0 to f (inclusive) are valid.
Default value is 0.
When '--pc=0' then '--eject', '--load', '--loej', '--start' and '--stop'
are active. Some common values are 1 for the active power condition (SBC);
2 for the idle power condition; 3 for the standby power condition; 5 for
sleep power condition (MMC); 7 for LU_CONTROL (SBC), 0xa (decimal 10) for
FORCE_IDLE_0 (SBC) and 0xb (decimal 11) for FORCE_STANDBY_0 (SBC).
See recent SBC-3, MMC-5 and SAS drafts at www.t10.org for more information.
.TP
--start
start (spin-up) given device. Using this option on an already started
device is harmless. Same meaning as "1" argument.
.TP
--stop
stop (spin-down) given device. Same meaning as "0" argument.
.TP
-v
verbose: outputs SCSI command in hex to console before with executing
it. '-vv' and '-vvv' are also accepted yielding greater verbosity.
.TP
-V
print out version string then exit.
.PP
All options, other than '-v' and '-V', can be given with a single "-".
For example: "sg_start -stop /dev/sda" and "sg_start --stop /dev/sda"
are equivalent. The single "-" form is for backward compatibility.
.PP
To avoid confusion, only one of "0", "1", "--load", "--eject", "--start"
and "--stop" can be given.
.PP
If this utility succeeds then its process exits with a status of 0;
otherwise it exits with a non-zero status.
.PP
There is an associated "power condition" mode page (0x1a) in which timer
values can be set for transitioning to either idle or standby state after
a period of inactivity. The sdparm utility can be used to view the
power condition mode page and if required change it.
If a device is in either idle or standby power condition state then
a REQUEST SENSE command (see the sg_requests utility) should yield 
a sense key of "no sense" and an additional sense code of "Low
power condition on" on recent SCSI devices.
.PP
Ejection of removable media (e.g. 'sg_start --eject /dev/hdd' where
the device is an ATAPI cd/dvd drive) may be prevented by a prior
PREVENT ALLOW MEDIUM REMOVAL SCSI command (see sg_prevent). In this
case this utility should fail with an error generated by the device:
illegal request / medium removal prevented. This can be overridden
using sg_prevent or 'sdparm --command=unlock /dev/hdd'.
.PP
In the 2.4 series of Linux kernels the given device must be
a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks
and SCSI DVDs) can also be specified. For example "sg_start 0 /dev/sda"
will work in the 2.6 series kernels.
.SH NOTES
Earlier versions had a '-s' option to perform a SYNCHRONIZE CACHE command
before the START STOP UNIT command was issued. According to recent SBC-2
drafts this is done implicitly if required. Hence the "-s" option has been
dropped.
.SH AUTHOR
Written by K. Garloff and D. Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2002-2006 Kurt Garloff, Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B sg_prevent(sg3_utils), sg_requests(sg3_utils), sdparm(sdparm)