The reason that

 $ udisks --detach /dev/sdX

spins down the disk properly but clicking the "Power off" menu item in
the GNOME Disks application doesn't has to do with the fact that the
udisks program is from udisks version 1 and was rewritten in udisks
version 2.

udisks v1: http://cgit.freedesktop.org/udisks/tree/src/helpers/job-
drive-detach.c?id=1.0.4

udisks v2:
http://cgit.freedesktop.org/udisks/tree/src/udiskslinuxdrive.c?id=2.1.2#n1195

As you can see, both v1 and v2 does this by writing a '1' to the
'remove' sysfs attribute on the parent USB device, as per

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=253e05724f9230910344357b1142ad8642ff9f5a

and this makes most USB-attached disk drives actually power down - at
least all the different devices that I've tested with.

However, what's missing in v2 (and present in v1) is the following steps

 1. sending the SCSI SYNCHRONIZE CACHE command
 2. sending START/STOP UNIT command
 3. unbinding the USB Mass Storage kernel driver

Notably, there's actually a TODO item in v2 for doing this:

 /* TODO: Send the eject? Send SCSI START STOP UNIT? */

Now, I don't think that 3. is necessary as it happens as part of writing
to the 'remove' sysfs file. That leaves 1. and 2.

Here's what I'd like to you try. Does

 sg_start --stop /dev/sdX

do what you want? If so, we should add 1. and 2. to v2.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gnome-disk-utility in Ubuntu.
https://bugs.launchpad.net/bugs/1239087

Title:
  Safely remove is not working (or broken) in Gnome Disks

Status in GNOME Disks:
  Fix Released
Status in abstraction for enumerating and managing block devices:
  Incomplete
Status in “gnome-disk-utility” package in Ubuntu:
  New
Status in “gnome-disk-utility” package in Fedora:
  Unknown
Status in “gnome-disk-utility” package in openSUSE:
  Confirmed

Bug description:
  In 12.04 I was able to safely remove USB-stick (make its LED off) and USB-HDD 
(do a spin down).
  In 13.04 this option is missed.

  In 13.10 it is appeared again, but not working as expected:
  +    Gnome Disks normally powers off the USB flash (tested on 4 different 
flashes and 2 USB cardreaders).
  -     Gnome Disks does not spin down USB HDD (but udisks --detach does)

  ProblemType: Bug
  DistroRelease: Ubuntu 13.10
  Package: gnome-disk-utility 3.8.2-1ubuntu2
  ProcVersionSignature: Ubuntu 3.10.0-1.8-generic 3.10.0-rc7
  Uname: Linux 3.10.0-1-generic i686
  NonfreeKernelModules: nvidia
  ApportVersion: 2.12.5-0ubuntu2
  Architecture: i386
  Date: Sat Oct 12 13:39:21 2013
  InstallationDate: Installed on 2013-03-06 (219 days ago)
  InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha i386 (20130306)
  MarkForUpload: True
  SourcePackage: gnome-disk-utility
  UpgradeStatus: Upgraded to saucy on 2013-06-23 (110 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/gnome-disk-utility/+bug/1239087/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to