man sg_start (Administration système) - starts (spins-up) or stops (spins down) SCSI device, load or eject medium

NAME

sg_start - starts (spins-up) or stops (spins down) SCSI device, load or eject medium

SYNOPSIS

sg_start [-eject] [-imm=0|1] [-load] [-loej] [-pc=<n>] [-start] [-stop] [-v] [-V] [0|1] <scsi_device>

DESCRIPTION

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.

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.

If no option or argument is given that implies some action, a '-start' is assumed.

0
stop (spin-down) given device. Active when '-pc=" is not given or '-pc=0'.
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).
-eject
stop the medium and eject it from the drive. Only appropriate for a removable medium.
-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).
-load
load the medium in the drive and start it. Only appropriate for a removable medium.
-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.
-pc=<n>
set the 'power conditions' value (in hex); 0 to f (inclusive) are valid. Default value is 0. When '-pc=0' then '-start', '-stop' and '-loej' 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-2, MMC-4 and SAS drafts at www.t10.org for more information.
-start
start (spin-up) given device. Using this option on an already started device is harmless. Same meaning as "1" argument.
-stop
stop (spin-down) given device. Same meaning as "0" argument.
-v
verbose: outputs SCSI command in hex to console before with executing it. '-vv' and '-vvv' are also accepted yielding greater verbosity.
-V
print out version string then exit.

To avoid confusion, only one of "0", "1", "-start" and "-stop" can be given.

If this utility succeeds then its process exits with a status of 0; otherwise it exits with a non-zero status.

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 the sginfo utility can view and 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".

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.

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.

NOTE

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.

AUTHOR

Written by K. Garloff and D. Gilbert

REPORTING BUGS

Report bugs to <dgilbert at interlog dot com>.

COPYRIGHT

Copyright © 2002-2005 Kurt Garloff, Douglas Gilbert

This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

sg_prevent(sg3_utils), sg_requests(sg3_utils), sdparm(sdparm), sginfo(sg3_utils)