Re: Does Linux support powering down SATA drives?
From: Douglas Gilbert
Date: Sun Nov 20 2005 - 07:22:20 EST
Marc Perkel wrote:
> Trying to save power consumption. I have a backup drive that is used
> only once a day to back up the main drive. So - why should I run it more
> that 10 minutes a day? What I'd like to do is keep it in an off state
> and then at night power it on, mount it up, do the backup, unmount it,
> and shut it down. Can I do that?
Yes, from lk 2.6.14 onwards.
An implementation (based on SAT:
http://www.t10.org/ftp/t10/drafts/sat/sat-r07.pdf) of
the START STOP UNIT SCSI command went into libata in
lk 2.6.14 . Hence you can use SCSI tools such as
sg_start (sg3_utils) or sdparm (sdparm) to place a
SATA disk in standby mode. For example:
"sg_start 0 /dev/sda" and "sdparm --command=stop /dev/sda"
are equivalent to "hdparm -y". The next command sent to that
disk will cause it to spin up again.
The power state machines of SCSI disks, ATA disks
and CD/DVD drives overlap but are not the same.
SATA and SAS transports add some wrinkles, see:
http://www.torque.net/sg/power.html
Spinning down disks with no mounted file systems makes
sense. However repeatedly spinning down a disk that is
periodically (e.g. 30 seconds later) accessed may shorten
its life.
In lk 2.6.15-rc1 implementations of the ATA COMMAND
PASS THROUGH (12 and 16 byte) SCSI commands went into
libata. These are defined in SAT (reference above).
libata also translates the HDIO_DRIVE_CMD and
HDIO_DRIVE_TASK ioctls into those pass through commands.
Recent versions of hdparm (I've tried 6.1 and 6.3) work as
expected. Hence "hdparm -y /dev/sda" puts the libata-connected
SATA disk /dev/sda into standby mode.
smartmontools also works for libata-connected SATA disks
in lk 2.6.15-rc1 .
The picture is not as bright for external USB and
1394 enclosures of ATA disks. They need to either
support the START STOP UNIT SCSI command or the
SAT pass through commands. I have not seen the
former and won't hold my breath waiting for the
latter.
Doug Gilbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/