Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#13 init.d scripts that reset settings on shutdown

open
nobody
None
5
2012-03-06
2012-03-06
Mathieu ROY
No

Hello,

I noticed that on some of my hard disk, settings like spindown_time are kept over reboot.
However, if I reboot on, say MS Windows, then I have no way to change this spindown_time, which could be a problem.

There are actually the -K and -k options, but they fail to work on all my drivers:
Example :

529 13:10 bender: /home/klink
# hdparm -K 0 /dev/sda

/dev/sda:
setting drive keep features to 0 (off)
HDIO_DRIVE_CMD(keepsettings) failed: Input/output error
530 13:10 bender: /home/klink
# hdparm -k 0 /dev/sda

/dev/sda:
setting keep_settings to 0 (off)
HDIO_SET_KEEPSETTINGS failed: Inappropriate ioctl for device
HDIO_GET_KEEPSETTINGS failed: Inappropriate ioctl for device
531 13:10 bender: /home/klink
# hdparm -i /dev/sda

/dev/sda:

Model=ST3250620AS, FwRev=3.AAK, SerialNo=9QE491YB
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=off
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=488397168
IORDY=on/off, tPIO={min:120,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 *udma6
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7

* signifies the current active mode

So I endup writing a dirty shutdown script to unset settings on all drives on shutdown.

I think it would be best if there was an option, for instance in /etc/hdparm.conf or /etc/default/hdparm to get hdparm to unset on boot every option it may have set (or to set to a value that cannot be harmful, to make it simple, for instance spindown_time = 0).

Discussion