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 Ubuntu
Desktop Bugs, 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

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

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to