LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-05-2010, 06:56 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
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 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
 
Old 04-05-2010, 12:50 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,229

Rep: Reputation: 173Reputation: 173
Pull the plug out!
I have a simple drive external and it powers down nicely when power is cut.
 
1 members found this post helpful.
Old 04-06-2010, 03:37 AM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,755

Rep: Reputation: 466Reputation: 466Reputation: 466Reputation: 466Reputation: 466
If you run sync before unmounting, or run eject, it should be safe to pull the plug.
 
Old 04-06-2010, 06:08 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Original Poster
Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by gnashley View Post
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 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.

Last edited by catkin; 04-06-2010 at 06:10 AM.
 
Old 04-06-2010, 08:26 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Quote:
Originally Posted by smeezekitty View Post
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.
 
Old 12-11-2011, 10:33 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Original Poster
Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Solution found and described in this LQ post.
 
  


Reply

Tags
hdd, suspend, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
External USB Simpledrive 1TB not working with Opensuse 11.0 paulneil Linux - Newbie 2 09-15-2009 05:43 PM
Cannot mount hitachi fotocamera as usb mass-storage in slackware 12.2 pierpatbsz Slackware 18 05-02-2009 04:55 AM
USB IR receivers supporting power on/off via mb power header dblade Linux - Hardware 0 09-16-2007 01:22 AM
mini tower Gateway Case and Power Supply mcanallyd Linux - Newbie 2 11-16-2006 12:16 AM
Sunami External USB 2.0 HDD caddy, Hitachi 40gb drive nickpye Linux - Hardware 1 02-16-2004 05:36 PM


All times are GMT -5. The time now is 03:28 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration