I'm setting up a Linux machine (Ubuntu 9.10) as a file server on my LAN and want to have a few of my external hard drives attached to it, but not always powered up. I've read that I can suspend USB devices (here and here) and this will power down the device until I want to wake it up later. Since my external drives are hard disks I think this will greatly extend their lifespan!

I want to make sure before I go ahead and run the commands that I'm doing exactly the right thing. I want to suspend the device at /dev/sdc1:

$ udevadm info -q path -n /dev/sdc1
# output: /devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4:1.0/host3/target3:0:0/3:0:0:0/block/sdc/sdc1
$ echo suspend > /sys/bus/usb/devices/1-4/1-4:1.0/host3/power/level

Then to turn the device back on:

echo on > /sys/bus/usb/devices/1-4/1-4:1.0/host3/power/level

Can someone confirm that I am writing the 'suspend' command to the correct file? Do I need to unmount the drive before I suspend?

link|improve this question
feedback

migrated from stackoverflow.com Jul 16 '11 at 14:49

This question came from our site for professional and enthusiast programmers.

2 Answers

You dont need to unmount the drive before the suspend. I dont understand what you mean into the other question.

link|improve this answer
ah thanks for answering about the unmounting! i amended the question slightly to make it a bit clearer. basically i just want to know if, given the above output (/devices/pci0000:00/0000......) i am echo-ing to the correct location? – mulllhausen Jul 16 '11 at 6:24
feedback
up vote 0 down vote accepted

after trying some things out i found that the /sys/bus/usb/devices/1-4/1-4:1.0/host3/power/level file actually did not exist.

the correct file was actually located at /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4/power/level which is far more logical - just add a /sys to the start of the output from the udevadm info -q path -n /dev/sdc1 command.

echoing suspend to this file will suspend the external hard drive - all the lights go off and it uses low power.

then echoing on to the same location will wake it up again!

now i can leave all my drives plugged in to my lan pc and suspend them until i want to use them :)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.