LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Not able to power down Hitachi SimpleDrive mini USB HDD (http://www.linuxquestions.org/questions/programming-9/not-able-to-power-down-hitachi-simpledrive-mini-usb-hdd-800105/)

catkin 04-05-2010 07:56 AM

Not able to power down Hitachi SimpleDrive mini USB HDD
 
Hello :)

Anybody had much luck/experience powering down USB HDDs?

I've not been able to find the commands to power down a Hitachi SimpleDrive mini USB HDD. Maybe it's not possible.

According to Yan Li's Blog, "The problem: according to its user manual, you should disconnect the drive safely when it is not active, but in a Linux system how to do this is not very straightforward. You may notice that after you unmount it (whether through command-line or a desktop environment), the drive is still spinning and it's LED on. If you read it's user manual carefully you'll find that the manufacturer never said it's safe to disconnect it from your system in such condition.

The quick solution to this problem
:
  1. send SYNC, then STOP command to the device, this can be done easily in Linux by unbinding the device
  2. suspend the USB port by echoing a "suspend" to the "/sys/bus/usb/devices/$DEVICE/power/level", where $DEVICE corresponding to the device of your USB device."
Sounds reasonable. I downloaded the latest version of Yan Li's script from his git, built a kernel with CONFIG_USB_SUSPEND enabled and tried it. No error messages but the HDD went right on spinning.

There were some reports of it being necessary to quiesce HDDs with sdparm first so I tried that but without sucess :scratch: Here's the last attempt
Code:

root@CW8:~# sdparm --command=sync /dev/sdc
    /dev/sdc: Hitachi  HTS545050B9A300
root@CW8:~# sdparm --command=stop /dev/sdc
    /dev/sdc: Hitachi  HTS545050B9A300
root@CW8:~# sdparm --command=eject /dev/sdc
    /dev/sdc: Hitachi  HTS545050B9A300
root@CW8:~# /home/c/d/bin/try/suspend-usb-device.sh -v /dev/sdc
Found device /devices/pci0000:00/0000:00:13.5/usb1/1-5 associated to /dev/sdc; USB bus id is 1-5
Syncing device /dev/sdc
Stopping device /dev/sdc
Unbinding device 1-5
Checking whether /devices/pci0000:00/0000:00:13.5/usb1/1-5 can be suspended
Suspending /devices/pci0000:00/0000:00:13.5/usb1/1-5 by writing to /sys/devices/pci0000:00/0000:00:13.5/usb1/1-5/power/level

This tried on Slackware 13.0 32-bit running a 2.6.29.6-smp kernel.

Best

Charles

smeezekitty 04-05-2010 01:50 PM

Pull the plug out!
I have a simple drive external and it powers down nicely when power is cut.

gnashley 04-06-2010 04:37 AM

If you run sync before unmounting, or run eject, it should be safe to pull the plug.

catkin 04-06-2010 07:08 AM

Quote:

Originally Posted by gnashley (Post 3925892)
If you run sync before unmounting, or run eject, it should be safe to pull the plug.

Thanks gnashley :) that's what I'm doing now. No choice! But I have two issues with it ...

Firstly, I'm with Yan Li in wanting to follow the manufacturer's recommendations.

Secondly I prefer not to waste electrical power. Even after umount, sync, stop and eject the spindle is still spinning and the drive is warm. Warm means dissipated energy means environmental damage -- and for for no benefit :doh: In this case the drive will be plugged into a 24x7 backup server so even a small waste adds up over a period.

EDIT: "sync" above refers to the sdparm command to flush the device's internal buffers, not the Linux sync command to flush kernel buffers to the file system.

pixellany 04-06-2010 09:26 AM

Quote:

Originally Posted by smeezekitty (Post 3925060)
Pull the plug out!
I have a simple drive external and it powers down nicely when power is cut.

smeeze*;
With your obvious experience with computers, you should know that this is typically not the right way to do things.

catkin 12-11-2011 11:33 AM

Solution found and described in this LQ post.


All times are GMT -5. The time now is 10:18 PM.