# hdparm -S doesn't works

## MOttS

Hi all

I'm trying to save power and extend the life of my HD by spinning it down after 5 minutes.  I know about hdparm so I tried

```

hdparm -S 1 /dev/hda

```

and the hard drive never stop.  If I do

```

hdparm -y /dev/hda

```

it stops until I ask something on the HD.  It's just the -S option that doesn't work.  I have a Western Digital 30 Gigs (WDC WD300AB-00BVA0).

Any idea ? .. or other means to stop the HD when I don't use it ?

Thanks for reading

EDIT: I did hdparm -i /dev/hda and got:

 Model=WDC WD300AB-00BVA0, FwRev=21.01H21, SerialNo=WD-WMA7H3041143

 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }

 RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=40

 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=58633344

 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

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: device does not report version:  1 2 3 4 5

If you read it carefully it is written AdvancedPM=no somewhere.  How do I turn it on ?  ...  I tried the -B option and got 

 setting Advanced Power Management level to 0xC8 (200)

 HDIO_DRIVE_CMD failed: Input/output error

MOttS

----------

## TripKnot

Read the man page for hdparm again.

Values passed to -S in the range of 1-240 are multiples of 5seconds not minutes. Perhaps the shutdown time you are using is too short and is not working properly.  I use -S240 (20min) and it works fine for me.

If you want the drive to spindown after 5 minutes use: -S60

----------

## MOttS

Doesn't work.  I tried -S12, -S24 and -S60 by hand.  I also tried to put that option in /etc/init.d/hdparm and 'rc-update add hdparm default' but that didn't work either.  I checked in my bios and all the APM options are enabled.  I really don't get it.

But again the -B option returns:

```

root@localhost gd # hdparm -B20 /dev/hda

/dev/hda:

 setting Advanced Power Management level to 0x14 (20)

 HDIO_DRIVE_CMD failed: Input/output error

```

Thanks for the try though

Anyone else?

MottS

----------

## PT_LAmb

Well, I might be wrong, but I think HDIO_DRIVE_CMD failed: Input/output error is related to the kernel. Maybe you chose a wrong motherboard chipset, or an unsupported Power Management driver.

Can you check on it. And again, this is only a hunch... I really don't know   :Embarassed: 

Good luck,

Ricardo Cordeiro  :Smile: 

----------

## MOttS

First, let me thanks you for your answer PT_LAmb !

My mobo uses a 751 PCI/AGP controller and the 756 PCI ISA IDE controller so here is what I choosed related to that in the kernel config (make menuconfig)

ATA/IDE/MFM/RLL support --> IDE, ATA & ATAPI block devices -->

-Generic PCI IDE interrupts support (build in)

-AMD Viper Support

Here is what it is said in the help file about the viper stuff:

 *Quote:*   

> 
> 
> This driver ensure (U)DMA support for the AMD756/760 Viper Chipset
> 
> 

 

There is nothing about Power Management driver.

Any idea ?

MOttS

----------

## PT_LAmb

 *MOttS wrote:*   

> Any idea ?

 

I really don't know.   :Sad: 

I too have a similar problem, but my motherboard is a Intel i845. And after searching the web, I think the solution might pass by upgrading the kernel from gentoo-sources-2.4.19-r10 to 2.4.20. What's your kernel version?

Try to check for something unusual on dmesg. Post it here, just to make sure.

Problems similar to mine displayed on dmesg unsucess on enabling devices, and continued to load the kernel. For instance, mine returns:

```
ICH4: (ide_setup_pci_device:) Could not enable device.
```

One thing I haven't checked yet are the IRQ assignments. Run lspci -vv, and check for IRQ 0 and IRQ 255.

I have to run now... Later I'll post the sites that I visited and got this information from. Or you can search on google for i845 HDIO_DRIVE_CMD, you'll probably find the same sites I did.

Good Luck,

Ricardo Cordeiro  :Smile: 

----------

## MOttS

I already use the 2.4.20 kernel. 

```

root@localhost gd # uname -a

Linux localhost 2.4.20-gentoo-r1 #1 Sat Feb 8 23:29:24 EST 2003 i686 AMD Duron(tm) Processor  AuthenticAMD GNU/Linux

```

Here is what lspci -vv gives on AMD75x lines.. everything seems to be recognised and work nicely.

```

root@localhost gd # lspci -vv

00:00.0 Host bridge: Advanced Micro Devices [AMD] AMD-751 [Irongate] System Controller (rev 25)

        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-

        Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR-

        Latency: 120

        Region 0: Memory at ea000000 (32-bit, prefetchable) [size=32M]

        Region 1: Memory at eddff000 (32-bit, prefetchable) [size=4K]

        Region 2: I/O ports at d800 [disabled] [size=4]

        Capabilities: [a0] AGP version 1.0

                Status: RQ=15 SBA+ 64bit- FW- Rate=x1,x2

                Command: RQ=0 SBA- AGP+ 64bit- FW- Rate=x1

00:01.0 PCI bridge: Advanced Micro Devices [AMD] AMD-751 [Irongate] AGP Bridge (rev 01) (prog-if 00 [Normal decode])

        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-

        Status: Cap- 66Mhz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-

        Latency: 120

        Bus: primary=00, secondary=01, subordinate=01, sec-latency=32

        I/O behind bridge: 0000b000-0000bfff

        Memory behind bridge: ede00000-efefffff

        Prefetchable memory behind bridge: d9c00000-e9cfffff

        BridgeCtl: Parity- SERR+ NoISA- VGA+ MAbort- >Reset- FastB2B-

00:07.0 ISA bridge: Advanced Micro Devices [AMD] AMD-756 [Viper] ISA (rev 01)

        Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

        Status: Cap- 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-

        Latency: 0

00:07.1 IDE interface: Advanced Micro Devices [AMD] AMD-756 [Viper] IDE (rev 07) (prog-if 8a [Master SecP PriP])

        Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

        Status: Cap- 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-

        Latency: 32

        Region 4: I/O ports at f000 [size=16]

00:07.3 Bridge: Advanced Micro Devices [AMD] AMD-756 [Viper] ACPI (rev 03)

        Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

        Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-

00:07.4 USB Controller: Advanced Micro Devices [AMD] AMD-756 [Viper] USB (rev 06) (prog-if 10 [OHCI])

        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B-

        Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-

        Latency: 16 (20000ns max), cache line size 08

        Interrupt: pin D routed to IRQ 9

        Region 0: Memory at efffe000 (32-bit, non-prefetchable) [size=4K]

```

Some dmesg line now .:

```

root@localhost gd # dmesg | grep AMD

CPU: AMD Duron(tm) Processor  stepping 01

PCI: Using IRQ router AMD756 VIPER [1022/740b] at 00:07.3

AMD7409: IDE controller on PCI bus 00 dev 39

AMD7409: chipset revision 7

AMD7409: not 100% native mode: will probe irqs later

AMD756: dev 1186:1300, router pirq : 1 get irq : 10

AMD756: dev 1102:0002, router pirq : 1 get irq : 10

i2c-amd756.o: Found AMD756 SMBus controller.

i2c-amd756.o: AMD756 bus detected and initialized

agpgart: Detected AMD Irongate chipset

```

I see ACPI somewhere in the lspci -vv .. could it be that I didn't enabled this in my kernel ?  I read the mobo manual and it is not stated anywhere about ACPI.. only APM.  This is why I didn't enabled that feature when I compiled the kernel.

...

MOTtS

----------

## PT_LAmb

Try it out... If it fails, the kernel will warn you. And most probably you'll have ACPI support, I think all modern systems do, and APM is a bit obsolete (somebody correct me if I'm wrong, please).

Has for the IRQ, you seem not to have any wrong ones, however I'm not an expert on the subject.

The dmesg looks fine.

I promess I'll post the URL pages that I've found yesterday, this evening (GMT).

Keep searching,

Ricardo Cordeiro  :Smile: 

----------

## broschi

I've been told that you will actually decrease your hdd lifetime if you shut it down all the time. It's been designed like a fan, to spin all the time. Just make sure that it is firmly seated and that the case doesn't vibrate neither, vibrations kill HDDs.

----------

## PT_LAmb

Ok... URLs postponed for tomorrow, and that's a maybe. I really gotta pass Fridays Computer Networks exam.  :Sad: 

Sorry about that,

Ricardo Cordeiro  :Smile: 

----------

## DArtagnan

I also have this shit:

```

starshooter root # hdparm -d1 -c1 -u1 -X66 -K1 /dev/hda

 

/dev/hda:

 setting 32-bit IO_support flag to 1

 setting unmaskirq to 1 (on)

 setting using_dma to 1 (on)

 setting drive keep features to 1 (on)

 HDIO_DRIVE_CMD(keepsettings) failed: Input/output error

 setting xfermode to 66 (UltraDMA mode2)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

starshooter root #

```

```

starshooter root # uname -a

Linux starshooter.huji.ac.il 2.4.21-ck3 #1 Sun Jun 29 07:21:52 IDT 2003 i686 Intel(R) Pentium(R) 4 CPU 1.50GHz GenuineIntel GNU/Linux

starshooter root #

```

I get  this from dmesg:

```

hda: drive_cmd: status=0x53 { DriveReady SeekComplete Index Error }

hda: drive_cmd: error=0x04 { DriveStatusError }

hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }

hda: drive_cmd: error=0x04 { DriveStatusError }

hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }

hda: drive_cmd: error=0x04 { DriveStatusError }

```

----------

