# What happened to the disk subsystem? sda->hda!? [SOLVED]

## dunkirk

So I'm reading about the kernel exploit, and thinking it's been awhile since I installed a new kernel. Turns out that I'm on kernels that aren't even in the tree any more. So I upgraded my laptop this morning. Since both suspend2-sources kernels I have are hard masked now, I installed the latest gentoo-sources. I have found that the kernel now calls my hard drive an hda device instead of an sda, requiring changes to the fstab and grub.conf. OK, fine. I can live with this just fine. However, PERFORMANCE HAS GONE TO HECK. Now just running a compile will cause audio to stutter! If I have two things running on the system, it slows to a crawl! I have a great laptop here (Dell M65 with 4 GB RAM and the "fast" hard drive). I should NOT be having these problems. The ONLY thing I changed this morning was the kernel! So there's nothing else going on here. Why'd they make the change? More importantly, what can I do to get my system back!?

----------

## kitsunenokenja

It may help if you let us know if this is parallel or serial ATA HDD, and if DMA is on according to hdparm. Here's an example:

```
# hdparm -v /dev/hda
```

----------

## dunkirk

workstation ~ # hdparm /dev/hda

/dev/hda:

 multcount     = 16 (on)

 IO_support    =  0 (default 16-bit)

 unmaskirq     =  0 (off)

 using_dma     =  0 (off)

 keepsettings  =  0 (off)

 readonly      =  0 (off)

 readahead     = 256 (on)

 geometry      = 16383/255/63, sectors = 156301488, start = 0

I did a quick Google, and this was the first hit: http://gentoo-wiki.com/HOWTO_Use_hdparm_to_improve_IDE_device_performance. I did some reading.

workstation ~ # hdparm -d1 /dev/hda

/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted <- Whoopsie.

 using_dma     =  0 (off)

If it matters:

workstation ~ # lspci |grep IDE

00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 01)

I tried what the article suggested: I compiled my SATA driver directly into the kernel (and took out all the others, just so it couldn't possibly be confused). I also checked every setting in the BIOS. It doesn't look like this BIOS gives me the ability to frob anything about the disk subsystem other than allowing it to ask for power-saving. Other than that, I'm at a loss.

----------

## Rufy

This problem can happen by having ATA and SATA enabled at the same time in the kernel.  Try enabling only the SATA drivers and see what that does.

----------

## i92guboj

In case it's a sata drive, you need to know that hdparm is useless and the driver itself should enable the dma without any other thing. For scsi drives (sata included) you must use sdparm.

----------

## djs

Try looking at your BIOS.  In my experience this was due to the settings of the SATA controller being in IDE mode instead of AHCI or SATA mode.  This could also be because you were using a really really old kernel that had no libata support for your controller and the newer one has switched to use libata (sata and recently pata support as well for some controllers).  I would personally just leave it alone and change my /etc/fstab to sda from hda.  Use a gentoo install CD to mount it and edit the fstab, reboot and you should be set.

/djs

----------

## kitsunenokenja

 *i92guboj wrote:*   

> In case it's a sata drive, you need to know that hdparm is useless and the driver itself should enable the dma without any other thing. For scsi drives (sata included) you must use sdparm.

 

That's interesting, I did not know this. Also, he provided his "lspci | grep IDE" output which indicates it is a SATA drive.

----------

## drescherjm

 *Quote:*   

> That's interesting, I did not know this. Also, he provided his "lspci | grep IDE" output which indicates it is a SATA drive.

 

Then unless you have other ide hard drives in your system you may need to turn off generic_ide support from your kernel. I have had to do this with a dell d820 laptop because with that turned on the drive was recognized as hda and netted less than 6MB/s in that mode when it is sda it gets 57MB/s...

----------

## dunkirk

I took Rufy's advice -- perhaps too literally -- and took out ALL IDE drivers from my system, and now it won't boot. So I'm a little confused now. When it boots, even without IDE installed, the kernel sees things like ATA devices, but (as someone else reiterated) we can see that my system only reports SATA controllers. So... I guess I have to punt here and ask: How does one configure an Intel ICH7 controller for Linux, from the ground up? From 2.22.x to 2.26.x, the kernel has simply changed how it addresses these devices. They went from /dev/sd? to /dev/hd?, but did they REALLY change? Does the kernel consider them IDE, ATA, PATA, or SATA, regardless of what `lspci' reports?

----------

## Rufy

It's not really that the devices renamed from /dev/sda to /dev/hda, for example, but that both drivers are trying to access the same hardware device.  I had a machine where this exact thing was happening and it was because I had both ICH7 SATA and the matching Intel IDE drivers compiled into the kernel.  For whatever reason, the IDE driver was the one visible, but trying to use the system was quite painful.

When you say it didn't boot, what was the message you got at the boot failure?  Did you remember to change your fstab to point to /dev/sd* instead of /dev/hd*?

----------

## Rufy

Here's my ATA and SATA kernel settings.  I'm running the same ICH7 SATA hardware as you on gentoo-sources-2.6.24.  Note the SCSI settings.

```
Device Drivers  --->

  < > ATA/ATAPI/MFM/RLL support  --->

      SCSI device support  --->

        <*> SCSI disk support

        <*> SCSI CDROM support

  <*> Serial ATA (prod) and Parallel ATA (experimental) drivers  --->

      <*>   Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support

```

----------

## dunkirk

OK, I tried Rufy's suggestion, and I get to the point of mounting the root device, and it hangs. Neither /dev/sda5 not /dev/hda5 work at that point. So, since I was at a complete loss, I blew away my .config file, let it do it's default thing, and I STILL get the same problem! I have no friggin' clue how to get this working now.

What in the world are the kernel dev's thinking? Why'd they go and change something so fundamental to begin with? Us old-timers remember when there such things as DEVELOPMENT kernels to do this sort of thing with. Dangit. I haven't had to think about my kernel for YEARS. This is ridiculous. I HATE COMPILING KERNELS.

----------

## dunkirk

Can anyone tell me what sort of devices they get when running an Intel ICH7 controller? SHOULD they be Hda or Sda? Rufy's post confuses me because he talks about them going the opposite way that mine seem to have gone. I don't know what to think any more.

----------

## Jaglover

IHC7 is probably IDE. Confusion arises when you use libata driver, it renames your hdx (IDE) devices to sdx.

----------

## Rufy

Here is the output of df on my machine:

```
Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda4             64707780  36088616  28619164  56% /

udev                     10240       160     10080   2% /dev

/dev/sdb1            156243352     32944 156210408   1% /usr/local

shm                     516772         0    516772   0% /dev/shm

/dev/sdc1              3940796   2400300   1540496  61% /media/disk[
```

/dev/sda1 is NTFS and not mounted atm.  /dev/sda2 is /boot, /dev/sda3 is swap.

Also, since I have standard IDE/ATA drivers completely disabled, I'm not using libata.  And the helpfiles specifically tell you that, if you enable the SATA drivers (not libata in the IDE section), then you may need to enable the SCSI disk support option under the SCSI driver section.

Any chance you can post your .config file?

----------

## drescherjm

Ok here is what I have:

```
# lspci | grep IDE

00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 01)

# uname -a

Linux localhost 2.6.24-gentoo #2 SMP PREEMPT Sun Jan 27 21:41:49 EST 2008 x86_64 Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz GenuineIntel GNU/Linux

```

Then my .config 

First the ATA/ATAPI/MFM/RLL section:

```

CONFIG_IDE=y

CONFIG_IDE_MAX_HWIFS=4

CONFIG_BLK_DEV_IDE=y

#

# Please see Documentation/ide.txt for help/info on IDE drives

#

# CONFIG_BLK_DEV_IDE_SATA is not set

# CONFIG_BLK_DEV_HD_IDE is not set

CONFIG_BLK_DEV_IDEDISK=y

CONFIG_IDEDISK_MULTI_MODE=y

# CONFIG_BLK_DEV_IDECS is not set

# CONFIG_BLK_DEV_DELKIN is not set

CONFIG_BLK_DEV_IDECD=y

# CONFIG_BLK_DEV_IDETAPE is not set

# CONFIG_BLK_DEV_IDEFLOPPY is not set

# CONFIG_BLK_DEV_IDESCSI is not set

# CONFIG_BLK_DEV_IDEACPI is not set

# CONFIG_IDE_TASK_IOCTL is not set

CONFIG_IDE_PROC_FS=y

#

# IDE chipset support/bugfixes

# CONFIG_IDE_GENERIC is not set

# CONFIG_BLK_DEV_PLATFORM is not set

CONFIG_BLK_DEV_CMD640=y

CONFIG_BLK_DEV_CMD640_ENHANCED=y

# CONFIG_BLK_DEV_IDEPNP is not set

#

# PCI IDE chipsets support

#

# CONFIG_IDEPCI_PCIBUS_ORDER is not set

# CONFIG_BLK_DEV_GENERIC is not set

# CONFIG_BLK_DEV_OPTI621 is not set

# CONFIG_BLK_DEV_RZ1000 is not set

# CONFIG_BLK_DEV_AEC62XX is not set

# CONFIG_BLK_DEV_ALI15X3 is not set

# CONFIG_BLK_DEV_AMD74XX is not set

# CONFIG_BLK_DEV_ATIIXP is not set

# CONFIG_BLK_DEV_CMD64X is not set

# CONFIG_BLK_DEV_TRIFLEX is not set

# CONFIG_BLK_DEV_CY82C693 is not set

# CONFIG_BLK_DEV_CS5520 is not set

# CONFIG_BLK_DEV_CS5530 is not set

# CONFIG_BLK_DEV_HPT34X is not set

# CONFIG_BLK_DEV_HPT366 is not set

# CONFIG_BLK_DEV_JMICRON is not set

# CONFIG_BLK_DEV_SC1200 is not set

# CONFIG_BLK_DEV_PIIX is not set

# CONFIG_BLK_DEV_IT8213 is not set

# CONFIG_BLK_DEV_IT821X is not set

# CONFIG_BLK_DEV_NS87415 is not set

# CONFIG_BLK_DEV_PDC202XX_OLD is not set

# CONFIG_BLK_DEV_PDC202XX_NEW is not set

# CONFIG_BLK_DEV_AMD74XX is not set

# CONFIG_BLK_DEV_ATIIXP is not set

# CONFIG_BLK_DEV_CMD64X is not set

# CONFIG_BLK_DEV_TRIFLEX is not set

# CONFIG_BLK_DEV_CY82C693 is not set

# CONFIG_BLK_DEV_CS5520 is not set

# CONFIG_BLK_DEV_CS5530 is not set

# CONFIG_BLK_DEV_HPT34X is not set

# CONFIG_BLK_DEV_HPT366 is not set

# CONFIG_BLK_DEV_JMICRON is not set

# CONFIG_BLK_DEV_SC1200 is not set

# CONFIG_BLK_DEV_PIIX is not set

# CONFIG_BLK_DEV_IT8213 is not set

# CONFIG_BLK_DEV_IT821X is not set

# CONFIG_BLK_DEV_NS87415 is not set

# CONFIG_BLK_DEV_PDC202XX_OLD is not set

# CONFIG_BLK_DEV_PDC202XX_NEW is not set

# CONFIG_BLK_DEV_SVWKS is not set

# CONFIG_BLK_DEV_SIIMAGE is not set

# CONFIG_BLK_DEV_SIS5513 is not set

# CONFIG_BLK_DEV_SLC90E66 is not set

# CONFIG_BLK_DEV_TRM290 is not set

# CONFIG_BLK_DEV_VIA82CXXX is not set

# CONFIG_BLK_DEV_TC86C001 is not set

# CONFIG_IDE_ARM is not set

# CONFIG_BLK_DEV_IDEDMA is not set

CONFIG_IDE_ARCH_OBSOLETE_INIT=y

# CONFIG_BLK_DEV_HD is not set

```

Then the Serial ATA (prod) and Parallel ATA (experimental) drivers:

```

CONFIG_ATA=y

# CONFIG_ATA_NONSTANDARD is not set

CONFIG_ATA_ACPI=y

CONFIG_SATA_AHCI=y

# CONFIG_SATA_SVW is not set

CONFIG_ATA_PIIX=y

# CONFIG_SATA_MV is not set

# CONFIG_SATA_NV is not set

# CONFIG_PDC_ADMA is not set

# CONFIG_SATA_QSTOR is not set

# CONFIG_SATA_PROMISE is not set

```

Every thing else in this section is not set.

This is basically what Rufy said but I have a few things checked in the ATA/ATAPI/MFM/RLL section. Most likely this is because I did not bother to remove them after getting the sata to work in sata mode.

----------

## Jaglover

 *Quote:*   

> Also, since I have standard IDE/ATA drivers completely disabled, I'm not using libata. And the helpfiles specifically tell you that, if you enable the SATA drivers (not libata in the IDE section), then you may need to enable the SCSI disk support option under the SCSI driver section. 

 

AFAIK if you use SATA section drivers for IDE then you are using libata.

----------

## drescherjm

To add to my earlier post, I do have SCSI device support and SCSI disk support built in my kernel.

----------

## dunkirk

OK. It's working. I followed what drescherjm had posted, but that was basically what Rufy had posted, so I'm not sure what I was doing wrong in the process. Anyway, I don't have ANY of the IDE stuff engaged, and my SATA section looks just like drescherjm's. It's even fast. It's back to using /dev/sd? devices. I'm still not sure if I should be measuring the performance with hdparm, but I started up Exaile, and then ran updatedb, and everything's perfect. (And then started another compile, just to abuse the system.)

Thanks for all the guidance. I'm sure the details will sink in with time. (But I still hate compiling kernels.)

----------

