Saturday, June 23, 2007

Intel PATA/SATA compatibility mode

I've reinstalled my colocated server (Tyan Transport GS12) last night with CentOS 5.0.

I figured I could just run the machine with the case open and a DVD drive connected to install CentOS. Unfortunately, the are only two power connectors (molex plugs) for the disks, so there was no way to connect the DVD drive at the same time as both disks. I worked around that by only connecting the first disk, but I had to change some BIOS settings (specifically, I had to set the Intel SATA controller to 'compatible mode'). I could then boot from the DVD I had brought with me.

After copying a bootable image (images/diskboot.img) to the disk, I booted from the first disk after disconnecting the DVD drive and reconnecting the disk. CentOS booted just fine, but complained about the partition table. It wanted to format the drive, which was fine with me. A side effect of this is that it screws up the bootable disk image, so you cannot use it a second time and have to restore it from the OS media.

After installing the OS, which went terribly slow, I checked that the server was running all required services and that the software RAID1 devices were resynching. Then I went home.

After some sleep I logged in on my server again, only to find it absurdly slow. 20% CPU load during disk transfers and a maximum throughput of about 3.2 MB/sec. After some googling it turns out I forgot to turn that compatibility mode off again. This causes the regular IDE driver to probe and configure the disk before the SATA (ata_piix in this case) and because both drivers are messing with the same disks, neither can enable DMA. This explains why I couldn't enable DMA with hdparm.

Some more googling led me to the combined_mode kernel parameter. Supposedly the default value is both, but you can also set it to ide or libsata to allow one of these drivers to set DMA mode. I did several tests, but I could not get this to work. In the end I used the following options to prevent the IDE driver from probing the disks: hda=noprobe hdc=noprobe

Now things are back to normal. Transfers of up to 60 MB/sec and negligible CPU load.

This upside of this mistake is that I found this page. I was thinking of getting another server and turning the old one into a database server with two Western Digital Raptor disks. Unfortunately, it seems only the Linux AHCI driver has NCQ support and my GS12 has a ICH5R chipset, which isn't supported by the new AHCI driver.

Btw. I have two older 74 GB Raptor disks - the ones with 8 MB cache. I've tried to use them in my GS12, but when I do the machines becomes rather unstable. This may have been caused by CentOS 4.2 in some way. Other reasons may include too much load on the PSU or incompatibilities between the ICH5R chipset and the (older) Raptor disks.

0 comments: