# SATA drive on Intel ICH5 -- success story

## claw

I bought a whopper SATA hard drive today for backups, foolishly believing that I could just pop it into my system in 15 minutes. Took nearly 12 hours to get it working. Although I searched the Gentoo Forums for advice, I only found part of what I needed (so this posting is in part a compilation from other postings). For the frustrated and weary who find this posting in the wee hours, here is my Tale of Woe.

First off, it wasn't exactly a SATA drive. It was an Ultra ATA/100 with an add-on PATA-to-SATA converter. To be exact, a Hitachi Deskstar 7K250 and an AMS DK-0719SA. I plugged 'em in, and the kernel didn't care. 2.6.6-rc1 SMP from development-sources.

Kernel Config

I had several problems. The first was my kernel configuration. (This information has been given elsewhere in these forums.) What didn't work:

  SCSI Device Support,

  Serial ATA Support (CONFIG_SCSI_SATA)

  Intel PIIX/ICH SATA Support (CONFIG_SCSI_ATA_PIIX)

    (or whatever is appropriate for your hardware)

Disable them. They don't help.

What did work:

  Normal ATA IDE driver. In my case, this included BLK_DEV_PIIX because I have an Intel ICH5 Southbridge. Nothing special to configure for SATA. (Search dmesg or /var/log/messages for "SATA", and you should see something in there, even before plugging in the new drive.)

BIOS

My BIOS's default was to "automatically" configure SATA. This was a problem because when I added my new drive, my devices plugged on IDE1 vanished. Seems the BIOS "automatically" configured my SATA ports as the IDE secondary master and slave, replacing the existing secondary master and slave on IDE1. The solution for my BIOS was to set SATA configuration to "manual" and set SATA Port 1 as the Tertiary Master and Port 2 as the Quaternary Master. (My BIOS does not report SATA drives during boot-up, but does omit listing IDE1 drives when a SATA drive is present.)

The BIOS configuration was a problem only because it caused a perfectly good CD burner and DVD drive to vanish. The SATA drive should have been visible to the kernel. But it wasn't.

Partitions

Up to this point, the kernel log showed no hint of recognizing my SATA drive. I wondered whether the hard drive, or the converter dongle, was defective. So I took off the converter and plugged the drive directly into an IDE ribbon cable. It worked great, so I partitioned the drive.

Then I plugged the converter back in, and mysteriously the kernel found my SATA drive. I don't know whether it was plugging the drive into the IDE cable that initialized it somehow, or whether it was creating the partitions. It's been fine ever since.

Which device?

I already had 4 IDE devices, /dev/hda - /dev/hdd. My SATA drive became /dev/hde (as posted elsewhere in this forum). To determine exactly how many IDE devices you have, and their names, look in the directory /proc/ide.

Hope this helps someone.

Best of luck to you.

----------

## claw

But wait! There's more!

As the SATA drive was destined for backups, I configured it to spin-down after 2 minutes with hdparm's -S option. This was a big problem. The kernel decided the SATA drive and one of my USB controllers should share IRQs, the same controller my printer was plugged into. After that, cupsd would not start, hotplug became inattentive, "lsusb" would not return accurate information, "lsusb -v" would hang, and the following messages started appearing in my system log:

usb 3-1: control timeout on ep0in

...

irq 18: nobody cared!

Of course, I changed several things at the same time, so it took me two days to figure out it was the "-S" option. As soon as I reset it (with "-S0"), everything started working again.

----------

## claw

Actually, "hdparm -S0" for the SATA drive didn't work so well. I learned that the IDE-SATA driver has a problem handling some hdparm directives. Whenever I used hdparm for the SATA drive, the device responded with an interrupt storm. 100,000 interrupts arrived before the kernel automatically disabled the IRQ (which also disabled my USB printer).

So I completely stopped using hdparm for the SATA drive. Additionally, I added the boot parameters "ide0=ata66 ide1=ata66" because I am using 80 conductor cables, and I now get equivalent performance without using hdparm at all.

My system is a lot more stable, the printer works all the time, though it still hangs occasionally when the SATA drive (which I have configured to sleep after 2 minutes) is mounted.

See kernel bug 2671

----------

