External disk won't spindown

Bug #444818 reported by Cpp
36
This bug affects 7 people
Affects Status Importance Assigned to Milestone
sdparm (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: sdparm

This has bugged me a long time on Jaunty, but it's still present on Karmic, so it definitely needs a fix. I remember earlier versions of Ubuntu did not have this bug. My current state is that I have done an update to Karmic from Jaunty via update manager.

Okay, I have a number of external hard disks including MyBooks that I connect over firewire and a WD Passport that's connected via USB. The problem becomes apparent whenever I try to remove the disks manually. I normally unmount them via a terminal and then spin them down before unplugging the cable... sort of my own *safely remove* feature. I invoke the "sdparm -C stop /dev/sdb" command as root (sudo -s) and on other linux systems the disks spin down nicely. However for some reason that is not the case on Jaunty/Karmic beta. the disks seem to be spinning down for a moment, but then they always power up again and respin to full speed like a music CD. The disk will spin down automatically after leaving it idle for long enough.

I'm opening a new bug report because this is still present on Karmic.

uname -a
Linux anomaly 2.6.31-11-generic #38-Ubuntu SMP Fri Oct 2 11:55:55 UTC 2009 i686 GNU/Linux

Possible related bug: https://bugs.launchpad.net/ubuntu/+bug/117713

ProblemType: Bug
Architecture: i386
Date: Tue Oct 6 20:52:38 2009
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: nvidia
Package: sdparm 1.02-1
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-11.38-generic
SourcePackage: sdparm
Uname: Linux 2.6.31-11-generic i686

Revision history for this message
Cpp (xcpp) wrote :
Revision history for this message
clubber (fkramer) wrote :

I also tested it recently and this bug made really made it through to Karmic as well. It's a bit annoying, but obiviously nobody found a solution for that issue up to now.

Revision history for this message
Antti Salminen (antti-salminen) wrote :

This doesn't occur only with sdparm but also sg_start from sg3-utils. My LaCie external HD has the same issue both on a Karmic desktop and a Jaunty server.

Problem seems to be related to udev as the copying of a modified udev rules file to /etc/udev/rules.d temporarily while running the commands as suggested in #117713 seems to work although seems a very unreliable solution. https://bugs.launchpad.net/ubuntu/+source/hdparm/+bug/388506 also seems like a somewhat similar issue that was affecting hdparm.

Revision history for this message
Antti Salminen (antti-salminen) wrote :

I did some further investigation. This is *exactly* the same issue as with hdparm. sg_start and sdparm both open the device file in read-write (O_RDWR) mode even though they only need to do it on read-only in order to do ioctls. Ubuntu's udev configuration watches the device files for being closed by a program that had them in open in O_RDWR mode and runs a helper which inspects the disk to add more information about the for udev. This triggers the disk to spin up right after it had been sent the command to spin down.

The solution is to change sg3-utils & sdparm to open on read only as they should have done to begin with. I tried it by compiling a version of sg_start with that modification and it worked as expected. It's hard to believe that this wouldn't have been done by any distribution after all this time.

Revision history for this message
Antti Salminen (antti-salminen) wrote :

Oh well, spoke a little too soon - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522859 seems to indicate *some* scsi commands do indeed, or have at some point required read-write. In any case that does not seem to be the case for sdparm -C stop.

Revision history for this message
George Politis (gpolitis) wrote :

>> ..seems like a somewhat similar issue that was affecting hdparm.

Ubuntu Lucid Lynx includes a relatively recent version of the sg3_utils package (1.28) that solves the problem and successfully suspends my external USB drive, at least for my configuration. The included sdparm is old (1.02) and it doesn't work.

Revision history for this message
George Politis (gpolitis) wrote :

I spoke a little too soon too. It seems that I can spin down my disk by doing sudo sg_start 0 /dev/sdb but only if the drive is mounted. This is already mentioned in bug #117713 by JoeZ251 in comment #45 (https://bugs.launchpad.net/ubuntu/+bug/117713/comments/45).

Revision history for this message
Cpp (xcpp) wrote : Re: [Bug 444818] Re: External disk won't spindown

I have figured out that if you use the sdparm command on a sg device
the disk will spin down properly. Use sg_map to find out your disk
mapping. You need to have sg3 utils installed.

sdparm -C stop /dev/sg1

On 9/18/10, 666f6f <email address hidden> wrote:
> I spoke a little too soon too. It seems that I can spin down my disk by
> doing sudo sg_start 0 /dev/sdb but only if the drive is mounted. This is
> already mentioned in bug #117713 by JoeZ251 in comment #45
> (https://bugs.launchpad.net/ubuntu/+bug/117713/comments/45).
>
> --
> External disk won't spindown
> https://bugs.launchpad.net/bugs/444818
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
George Politis (gpolitis) wrote :

Cpp, you are the master of the universe.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sdparm (Ubuntu):
status: New → Confirmed
Revision history for this message
Povilas Kanapickas (p12) wrote :

As of version 1.07-1, sdparm includes --readonly option, which can be used along --command=stop to spin down the disk. This fixes this bug.

Changed in sdparm (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.