• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: USB_SUSPEND  (Read 1742 times)
Trune
Jr. Member
**

Karma: 3
Posts: 70


View Profile
« on: March 08, 2010, 03:02:47 PM »

Hi all, ive done some research and got my usb hard drive enclosures to spin down and totally power off using the following commands;

/sys/bus/usb/devices# echo suspend > 1-2/power/level

and they powered down nicely.

now it turns out everythings enabled that should make this happen automatically?
however i understand that this cant happen because usb-storage doesnt allow the suspending of the devices automatically?

I was wondering, is there someone who can write a script that i can put in a cron job every 5 minutes to do this automatically? Before running each command i want it to check the file system is not mounted, and hasnt been for 10 seconds or so. or even better check for hard disk activity.

Alternatively is there a way of modifying the way autofs / automount works? can i get that to suspend the drives after unmounting them, and unsuspend them before remounting them?

any help would be appreciated.

thanks
Logged

Trune
Jr. Member
**

Karma: 3
Posts: 70


View Profile
« Reply #1 on: March 25, 2010, 01:27:13 PM »

no one?
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 429


View Profile WWW
« Reply #2 on: March 25, 2010, 05:27:50 PM »

A few comments.
The length of time a file system on the disk (there could be more than one) has not been mounted is irrelevant.  Once it's been unmounted that's it - another 10s makes no difference.
BUT - any check you make only applies when you make the check.  A few milliseconds (at least) will elapse before you can run the command to power the drives down, and in that time something else (this is a multi-user system) could mount a file-system and start using it.
Logged

knireis
Jr. Member
**

Karma: 2
Posts: 88


View Profile
« Reply #3 on: March 26, 2010, 02:38:33 AM »

I  tried your solution to spindown the usbdisk but I get this error.

sheeva:/sys/bus/usb/devices# echo 2 > 1-1/power/level
-bash: 1-1/power/level: No such file or directory
Logged

Trune
Jr. Member
**

Karma: 3
Posts: 70


View Profile
« Reply #4 on: March 26, 2010, 02:44:03 PM »

A few comments.
The length of time a file system on the disk (there could be more than one) has not been mounted is irrelevant.  Once it's been unmounted that's it - another 10s makes no difference.
BUT - any check you make only applies when you make the check.  A few milliseconds (at least) will elapse before you can run the command to power the drives down, and in that time something else (this is a multi-user system) could mount a file-system and start using it.

Hi Birdman,

i see your point and i agree. I wasnt writing a perfect solution, i was hoping i could get some help with that.
i.e i guess the perfect solution would be, check its not mounted, make it unmountable (i.e remove it from automount), check its not mounted again, then send power down command.
Then obviously reverse the process to make it possible to be woken up and remounted.

to be honest i just asumed things like this would be possible with linux, if its doable in windows i thought it would be pretty easy in linux.


Logged

Trune
Jr. Member
**

Karma: 3
Posts: 70


View Profile
« Reply #5 on: March 26, 2010, 02:46:01 PM »

I  tried your solution to spindown the usbdisk but I get this error.

sheeva:/sys/bus/usb/devices# echo 2 > 1-1/power/level
-bash: 1-1/power/level: No such file or directory


Hi,

i was just really giving an example, to give the idea of what im trying to do.

The exact command may not apply to your setup due to different usb devices i guess.

If your interested in the command, have a read of this page... this will tell you how to give the correct command for your system.

http://www.lesswatts.org/projects/devices-power-management/usb.php

Logged

birdman
Sr. Member
****

Karma: 4
Posts: 429


View Profile WWW
« Reply #6 on: March 28, 2010, 05:06:44 PM »


i.e i guess the perfect solution would be, check its not mounted, make it unmountable (i.e remove it from automount), check its not mounted again, then send power down command.
No.  The "perfect" way to do it is for the power down code (in the kernel) to check for nothing being mounted, and to do so while holding a lock that stops anything starting to use the device.  So you should check whether the kernel powerdown code does already check for non-usage of device.
« Last Edit: March 31, 2010, 05:55:27 PM by birdman » Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #7 on: March 30, 2010, 11:56:35 AM »

If you're only interested in powering down the hard disk and don't care about the fact that the USB controller is still active, you might want to check out hd-idle.sf.net

Thanks,
--Christian
Logged

Trune
Jr. Member
**

Karma: 3
Posts: 70


View Profile
« Reply #8 on: March 30, 2010, 02:27:49 PM »

All i want to do really is to do what the drives were designed to do, and do perfectly well in windows.

And this is to power off when not being used. Not just spin down.

In linux i can get them to spin down, but in windows the drives spin down, then power off the caddy to a next to nothing power usage (one of them doesnt even register on a power meter in this state).

I brought this unit to be as power efficiant as possible as thats how it was advertised, but it seems to struggle with what should be simple things like this. I thought it would be alot better documented these kind of features too.

i'll have a look at your link though.
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #9 on: March 30, 2010, 03:20:25 PM »

Hmm... you definitely got a point here: harddisk power management in Linux is largely focused around being able to send power-saving commands to IDE or ATA disks and letting the disks deal with it. On the other side, power management in Linux is becoming more and more an integral part of the kernel so I wouldn't be surprised to see this changing soon.

Either way, spinning down a hard disk will reduce power consumption of the disk to a few milliwatts. I would think the main reason why shutting down USB as well might be benefitial is not necessarily the disk controller or the enclosure but the fact that USB is designed to wake up the host CPU (or at least the DMA unit) periodically. How much power do your caddies consume when the disk is spun down but the caddy is still active?

« Last Edit: March 30, 2010, 03:25:14 PM by cjm » Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #10 on: April 05, 2010, 12:46:22 PM »

BTW, I just read that Linux 2.6.34 will contain improvements in I/O device power management. I haven't looked up any details so far but this might be what you're looking for.

Thanks,
--Christian
Logged

Pages: [1]
Print
Jump to: