Linux - General This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-10-2009, 08:55 PM
|
#1
|
|
Member
Registered: Feb 2005
Posts: 74
Rep:
|
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.
|
|
|
|
07-11-2009, 03:09 PM
|
#2
|
|
Member
Registered: Feb 2006
Distribution: Debian Sid
Posts: 217
Rep:
|
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.
|
|
|
|
|
07-11-2009, 05:29 PM
|
#3
|
|
Member
Registered: Feb 2005
Posts: 74
Original Poster
Rep:
|
I had come across the utility in my Googling, but I'm pretty sure it doesn't work for USB drives. I got the following result:
Code:
# hdparm -S 0 /dev/sda
/dev/sda:
setting standby to 0 (off)
HDIO_DRIVE_CMD(setidle1) failed: Input/output error
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.
|
|
|
|
07-11-2009, 06:09 PM
|
#4
|
|
Member
Registered: Feb 2006
Distribution: Debian Sid
Posts: 217
Rep:
|
Quote:
|
. . . that seems awfully hackish.
|
I agree. Seems like there should be a solution.
Maybe you've already tried this hdparm option:
Quote:
--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.
|
|
|
|
|
04-12-2010, 02:53 AM
|
#5
|
|
Member
Registered: Feb 2005
Posts: 74
Original Poster
Rep:
|
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. 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:16 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|