LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 07-10-2009, 08:55 PM   #1
nonoitall
Member
 
Registered: Feb 2005
Posts: 75

Rep: Reputation: 16
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.
 
Old 07-11-2009, 03:09 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
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.
 
Old 07-11-2009, 05:29 PM   #3
nonoitall
Member
 
Registered: Feb 2005
Posts: 75

Original Poster
Rep: Reputation: 16
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.
 
Old 07-11-2009, 06:09 PM   #4
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
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.
 
Old 04-12-2010, 02:53 AM   #5
nonoitall
Member
 
Registered: Feb 2005
Posts: 75

Original Poster
Rep: Reputation: 16
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.
 
  


Reply

Tags
autofs, debian, drive, mount, nas, spin, unmount, usb



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install to a usb hard drive (with spinning platters) murankar Linux - Software 2 04-16-2008 08:31 PM
Mount usb if hard drive is mounted in sda nifflerX Linux - General 1 10-05-2005 02:51 PM
Hard Drive Noise...Constantly Spinning bond00 Linux - Hardware 0 02-10-2005 11:09 PM
USB Hard Drive mounted: No files shown. mooreted Slackware 3 12-06-2004 06:51 PM
Hard drive doesnt stop spinning sooty Linux - General 3 11-14-2002 05:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration