How can one get USB external disk drive to "sleep"?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The drive itself can be commanded to sleep, but exactly how depends on the USB chipset that is providing the interface between the drive and the computer. You would do best to execute an lsusb command, then google on the chipset to find the answer that is appropriate to your system.
I make one of my drives spin down with this command (I had to install the relevant package first):
Thanks Jim for the info on sg_utils (which I have downloaded) but they don't seem to offer power management such as spinning down and going into standby after a period of inactivity.
I've discovered this and it seems to do the trick.
After you've found your usb device in /sys/bus/usb/devices you change the autosuspend and level files as described in that link.
Quote:
Autosuspending USB devices
To attempt to autosuspend your USB device, first use lsusb as root to find out the bus number and device number of your usb device:
Code:
# lsusb
Bus 005 Device 014: ID 04b3:4485 IBM Corp.
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 009: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
Bus 004 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 008: ID 04b3:310c IBM Corp.
Bus 001 Device 007: ID 050d:0121 Belkin Components F5D5050 100Mbps Ethernet
Bus 001 Device 001: ID 0000:0000
Then find your device's directory in /sys/bus/usb/devices/. Look in directories that are named with two numbers separated with a dash:
We know the USB to ethernet device's directory is 1-2 because the device and bus numbers match the lsusb output. Now we can tell the kernel that it should suspend this device automatically if it is not being used. First we set the idle timeout to 2 seconds:
The timeout can be set to any integer number of seconds. If set to -1, the device will not autosuspend. Then we make sure the kernel will automatically suspend the device, and resume the device if data needs to be transferred:
Code:
/sys/bus/usb/devices# echo auto > 1-2/power/level
Other options to echo to this file are "on" and "suspend":
* "on" will force the device to be on all the time.
* "suspend" will permanently suspend the device until the user echoes "on" or "auto" to this file.
(Note that this is a simplification, since the value of the power/wakeup file may allow the device to signal a remote wakeup.)
Checkmate, the reason for doing all this is to conserve power and save on wear and tear of the devices.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.