Keep USB hard drive from spinning down while mounted
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
Keep USB hard drive from spinning down while mounted
I have Debian running on a NAS server, which has a USB hard drive attached to it. The USB hard drive has a built in mechanism that makes the disk spin down after five minutes of inactivity. The NAS automatically mounts/unmounts the drive with autofs.
Is there any way I can keep the drive from spinning down as long as it's mounted? I would have thought that having a journaling file system (ext3) on the drive would automatically cause periodic disk activity, but if I don't do anything to access the files/directories on the drive for a few minutes the drive still spins down, even when it's still mounted.
Really don't know anything about this but have you looked into "hdparm"?
From the hdparm man page:
Quote:
-S Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive. This timeout value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. . . . . A value of zero means "timeouts are disabled": the device will not automatically enter standby mode.
For the moment, I have a makeshift solution with a script that creates/deletes an empty file on the drive every 200 seconds while it's mounted, but that seems awfully hackish.
--prefer-ata12
When using the SAT (SCSI ATA Translation) protocol, hdparm normally prefers to use the 16-byte command format whenever possible. But some USB drive enclosures don’t work correctly with 16-byte commands. This flag can be used to force use of the smaller 12-byte command format with such drives.
I know it took me a ridiculously long time to respond but it appears that command worked. (At the time you suggested it I was running a version of hdparm that didn't support that parameter, but I've since moved the drive to a different machine with a distro that has more up-to-date packages.) I just tried it a few minutes ago, so only time will tell if the drive spins down or not, but it didn't spit out any errors when I issued the command, so I'm hopeful.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.