Debian hdd spindown

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 13:53, 26 August 2006 by Joshuapurcell (Talk)

Jump to: navigation, search

If you're not using your Kurobox 24 hours a day, it could be good to allow the hard drive to spin down and reduce noise and power usage. For this you'll need to install hdparm to tune the sleep delay, and configure syslog to prevent it from writing to the disk, causing it to wake up every 20 minutes!

Install, Test & Configure 'hdparm'


Use apt-get to install hdparm as well as any dependencies automatically:

apt-get install hdparm


You can find out what your drive's settings are by running this command:

hdparm -i /dev/hda

Typical output would be something like this:

kurobox:~# hdparm -i /dev/hda
Model=ST3320620A, FwRev=3.AAC, SerialNo=5QF06WD4
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=16384kB, MaxMultSect=16, MultSect=16
CurCHS=65535/1/63, CurSects=4128705, LBA=yes, LBAsects=268435455
IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes:  pio0 pio1 pio2 pio3 pio4
DMA modes:  mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=no WriteCache=disabled
Drive conforms to: device does not report version:
* signifies the current active mode

You can give options to the hdparm command to either view or change specific characteristics. Look through the man page or /etc/hdparm.conf to find out what each option does. For example, changing the spindown time to 5 minutes from the command-line would be:

hdparm -S60 /dev/hda

Read through this Gentoo wiki page to find out some good options to play with in order to possibly increase your drive performance. Make sure to run this drive test both before and after in order find out whether you changes made things better or worse.


Once you have found the best possible settings for your drive, edit the hdparm configuration file:

vi /etc/hdparm.conf

You can either uncomment the lines about /dev/hda at the end of the file, which would make the section look like this:

/dev/hda {
       mult_sect_io = 16
       write_cache = off
       dma = on
       spindown_time = 120

Add any additional options within the curly brackets for those changes to be permanent. You can also edit the options individually throughout the file (information on each option is provided as comments within the file).

One last step is to make sure hdparm runs for at least your chosen runlevel. For some reason hdparm is not set to run on runlevel 2 by default, so use this command to first remove it's rc.d entries:

update-rc.d -f hdparm remove

Then use this command to add it back to runlevel 2 (with shutdown running at reboot, shutdown, and single-user mode):

update-rc.d hdparm start 19 2 . stop 19 0 1 6 .

In the above example I've set hdparm's priority to 19 so it is before such things as NFS, Webmin, etc. You can change this to some other reasonable setting (check your /etc/rc2.d folder to find a good number).

Modify syslogd Configuration

If you do not do that, your HDD will be turned on every 20 minutes because syslog will log a "MARK" in /var/log/messages every 20 minutes. So we need to remove that marking : edit /etc/init.d/sysklogd and set SYSLOGD to

SYSLOGD="-m 0"