Bug 553039 - sg_start --stop does not spin down external USB drive
Summary: sg_start --stop does not spin down external USB drive
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: sg3_utils
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Dan Horák
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-06 21:58 UTC by Martin Burchell
Modified: 2010-04-16 06:51 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-04-16 06:51:00 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch to sg_start to open the device readonly for --stop (677 bytes, patch)
2010-02-05 21:11 UTC, Martin Burchell
no flags Details | Diff

Description Martin Burchell 2010-01-06 21:58:03 UTC
Description of problem:
Since moving from Fedora 10 to Fedora 11, I can no longer spin down my external USB drive with sg_start --stop. This means I can't disconnect the drive without it making a painful squeaking sound, which I'm sure isn't good for it.

Version-Release number of selected component (if applicable):
sg3_utils-1.26-4.fc11.i586

How reproducible:
Every time

Steps to Reproduce:
1. Plug in external USB drive
2. Type sg_start --stop /dev/sdb1
3.
  
Actual results:
Drive momentarily spins down and then immediately spins up again

Expected results:
Drive spins down and doesn't spin up again

Additional info:
Model of USB drive is Freecom Mobile Drive 120 GB (Samsung HM120JC)

Comment 1 Dan Horák 2010-01-07 07:53:55 UTC
There is no change in sg_start between Fedora 10 and 11. As you write the drive is spined down and then spins up again, I would expect sg_start works, but something else is causing the spin up (kernel?). Are all partitions from the drive unmounted before running sg_start? Are you running it from a graphical desktop environment or console?

Comment 2 Martin Burchell 2010-01-07 09:33:36 UTC
(In reply to comment #1)
> There is no change in sg_start between Fedora 10 and 11. As you write the drive
> is spined down and then spins up again, I would expect sg_start works, but
> something else is causing the spin up (kernel?). 

Yes, I think you are right.

> Are all partitions from the
> drive unmounted before running sg_start? 

Yes

> Are you running it from a graphical
> desktop environment or console?  

I get the same problem in both the graphical environment and from the console.

Comment 3 Dan Horák 2010-01-07 17:46:34 UTC
So now we should try to find the right component for this bug report. Next step could be to boot the system in single user mode - either boot with 1 or S appended on the "kernel" line in grub or run "telinit 1" from console, and try again. It's also possible to stop almost all running daemons (with "service foo stop" or by killing them). When nothing will run (besides udevd) and the device will be powering up then it should be kernel's fault. Otherwise it will be some of the stopped user space components.

Comment 4 Martin Burchell 2010-01-07 21:32:34 UTC
(In reply to comment #3)
> So now we should try to find the right component for this bug report. Next step
> could be to boot the system in single user mode - either boot with 1 or S
> appended on the "kernel" line in grub or run "telinit 1" from console, and try
> again.

Thanks for that suggestion.  I booted into single user mode, repeated the sg_start instruction as before and the drive behaves in the same way ie spins down and immediately up again.  So if I understand comment#3 correctly, we can file this as a kernel bug.

kernel version is kernel-PAE-2.6.30.10-105.fc11.i686, although I've seen the same behaviour with kernel-PAE-2.6.29.4-167.fc11.i686

Comment 5 Dan Horák 2010-02-04 16:04:45 UTC
I think bug #561876 tries to solve same issue with different utility.

Comment 6 Martin Burchell 2010-02-05 21:04:35 UTC
Thanks for pointing that out.  Using that information I've created a patch for sg_start.

Comment 7 Martin Burchell 2010-02-05 21:11:13 UTC
Created attachment 389195 [details]
Patch to sg_start to open the device readonly for --stop

Limited testing:

sg_start --stop now spins the drive down and it doesn't spin up again.
sg_start --start spins the drive up again.

Comment 8 Dan Horák 2010-04-16 06:51:00 UTC
sg_start in sg3_utils 1.29 (available in rawhide) adds a new option --readonly to workaround the difference between ATA and SCSI devices. See bug #561876 for more details.


Note You need to log in before you can comment on or make changes to this bug.