# /dev/hda to /dev/sda, and how to use libata SOLVED

## Fog_Watch

I would like to move my old Intel PIIX4-connected IDE disk from IDE to libata.  

The relevant part of my /usr/src/linux/.config looks like:

```
# CONFIG_IDE is not set

CONFIG_SCSI=y

CONFIG_SCSI_DMA=y

CONFIG_SCSI_PROC_FS=y

CONFIG_BLK_DEV_SD=y

CONFIG_BLK_DEV_SR=y

CONFIG_CHR_DEV_SG=y

CONFIG_SCSI_WAIT_SCAN=m

CONFIG_ATA=y

CONFIG_ATA_PIIX=y

CONFIG_ATA_GENERIC=y
```

That is, IDE is off and ATA is turned on.

I can boot.  But:

```
# ls /dev/hda

/dev/hda

# ls /dev/sda

ls: cannot access /dev/sda: No such file or directory

```

Even though I have booted under what I thought was libata, the disk is still recognised as /dev/hda.  Huh.

When I boot that latest SystemRescueCD (1.2.0) the disk is visible as /dev/sda.

Please, can anyone shed some light on why I still have /dev/hda and don't have /dev/sda?

Regards

Fog_Watch.Last edited by Fog_Watch on Tue Jul 14, 2009 1:34 am; edited 1 time in total

----------

## sebaro

Are you sure you're using the new kernel?

 *Quote:*   

> When I boot that latest SystemRescueCD (1.2.0) the disk is visible as /dev/sda. 

 

They're using libata:

 *Quote:*   

> both IDE and SATA hard disk drivers are based on the libsata (all disks are sda, sdb, ...)

 

----------

## Fog_Watch

 *sebaro wrote:*   

> Are you sure you're using the new kernel?

 

```
# uname -r

2.6.24-gentoo-r8

```

Not fresh, but not old either.  SystemRescueCD 1.2.0 uses something like 2.6.29.  I'll update the kernel.

----------

## sebaro

 *sebaro wrote:*   

> Are you sure you're using the new kernel?

 

I meant the new kernel image you have compiled.

Remember to change in grub root=/dev/hdaX to root=/dev/sdaX

Same in /etc/fstab, or you can use UUID or LABEL instead of /dev/device.

```
CONFIG_ATA_PIIX=y 

CONFIG_ATA_GENERIC=y
```

You don't need the generic driver.

----------

## krinn

```
cat .config | grep ATA

CONFIG_X86_MCE_NONFATAL=y

# CONFIG_RELOCATABLE is not set

# CONFIG_ATALK is not set

# CONFIG_ATA_OVER_ETH is not set

# ATA/ATAPI/MFM/RLL support

# CONFIG_BLK_DEV_IDE_SATA is not set

# CONFIG_SCSI_EATA is not set

# Serial ATA (prod) and Parallel ATA (experimental) drivers

CONFIG_ATA=y

# CONFIG_ATA_NONSTANDARD is not set

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_SATA_QSTOR is not set

CONFIG_SATA_PROMISE=m

# CONFIG_SATA_SX4 is not set

# CONFIG_SATA_SIL is not set

# CONFIG_SATA_SIL24 is not set

# CONFIG_SATA_SIS is not set

# CONFIG_SATA_ULI is not set

# CONFIG_SATA_VIA is not set

# CONFIG_SATA_VITESSE is not set

CONFIG_SATA_INTEL_COMBINED=y

# CONFIG_PATA_ALI is not set

# CONFIG_PATA_AMD is not set

# CONFIG_PATA_ARTOP is not set

# CONFIG_PATA_ATIIXP is not set

# CONFIG_PATA_CMD64X is not set

# CONFIG_PATA_CS5520 is not set

# CONFIG_PATA_CS5530 is not set

# CONFIG_PATA_CS5535 is not set

# CONFIG_PATA_CYPRESS is not set

# CONFIG_PATA_EFAR is not set

# CONFIG_ATA_GENERIC is not set

CONFIG_PATA_HPT366=m

CONFIG_PATA_HPT37X=m

CONFIG_PATA_HPT3X2N=m

CONFIG_PATA_HPT3X3=m

# CONFIG_PATA_IT821X is not set

CONFIG_PATA_JMICRON=m

# CONFIG_PATA_TRIFLEX is not set

# CONFIG_PATA_MARVELL is not set

# CONFIG_PATA_MPIIX is not set

# CONFIG_PATA_OLDPIIX is not set

# CONFIG_PATA_NETCELL is not set

# CONFIG_PATA_NS87410 is not set

# CONFIG_PATA_OPTI is not set

# CONFIG_PATA_OPTIDMA is not set

# CONFIG_PATA_PDC_OLD is not set

# CONFIG_PATA_RADISYS is not set

# CONFIG_PATA_RZ1000 is not set

# CONFIG_PATA_SC1200 is not set

# CONFIG_PATA_SERVERWORKS is not set

# CONFIG_PATA_PDC2027X is not set

# CONFIG_PATA_SIL680 is not set

# CONFIG_PATA_SIS is not set

# CONFIG_PATA_VIA is not set

# CONFIG_PATA_WINBOND is not set

# CONFIG_USB_STORAGE_DATAFAB is not set

```

```
00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)

00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev 02)

uname -r

2.6.20-gentoo-r3

ls /dev/hd*

ls: ne peut accéder /dev/hd*: Aucun fichier ou répertoire de ce type

ls /dev/sd*               

/dev/sda  /dev/sda1  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1  /dev/sdc2  /dev/sdc3  /dev/sdc4  /dev/sdd  /dev/sdd1

```

PATA_MPIIX and PATA_OLDPIIX unset, SATA_AHCI, SATA_INTEL_COMBINED and ATA_PIIX set.

I'm sorry because some options might have their names changed with a newer kernel.

I hope it will help you anyway

----------

## NeddySeagoon

Fog_Watch,

Look Here

----------

## krinn

 :Smile:  you can add test on ich5R too neddyseaggon

----------

## NeddySeagoon

krinn,

Thank you. I trust you don't mind the credit?

----------

## krinn

lmao  :Wink: 

of 'course not needy

----------

## Nerevar

Are there any pros/cons to using libata other than the pro of being able to use one interface for all devices?

----------

## NeddySeagoon

Nerevar,

libata is easier to set up, so you get DMA out of the box.

The old IDE driver is in lots of bits.

On the down side (its a very small down) as yet, libata only supports 16 bit transfers from the PATA chipset to RAM.

Its a small down because the data path down the PATA cable is only 16 bits. You might notice if you benchmarked under heavy RAM bandwidth loads. It means that twice as many RAM accesses are needed to move the data from RAM to/from the PATA chipset as you need with the old driver.

----------

## krinn

```
ata1: PATA max UDMA/100 cmd 0xEFE0 ctl 0xEFAE bmdma 0xEF90 irq 16

ata2: PATA max UDMA/100 cmd 0xEFA0 ctl 0xEFAA bmdma 0xEF98 irq 16

scsi0 : ata_piix

scsi1 : ata_piix

ata2.00: ATA-6, max UDMA/100, 390721968 sectors: LBA48 

ata2.00: ata2: dev 0 multi count 16

ata2.00: configured for UDMA/100

scsi 1:0:0:0: Direct-Access     ATA      WDC WD2000JB-00G 08.0 PQ: 0 ANSI: 5

SCSI device sda: 390721968 512-byte hdwr sectors (200050 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO 

or FUA

SCSI device sda: 390721968 512-byte hdwr sectors (200050 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO 

or FUA

 sda: sda1

sd 1:0:0:0: Attached scsi disk sda

...

```

using that with my old ICH5R chipset, and showing you that one (because it's a PATA one) gives me results that are (still for a PATA drive) more than honorable

```
hdparm -t /dev/sda

/dev/sda:

 Timing buffered disk reads:  174 MB in  3.03 seconds =  57.47 MB/sec

```

Without it (on a previous kernel with OLDPATAPIIX or generic controllerl) i was at 38-42MB/s (even without trusting "as-is" hdparm benchmarking a drive, could say it's not bad improvment).

And now my newest m/b with a SATA1 running without AHCI (for testing)

```
00:1f.5 IDE interface: Intel Corporation 82801I (ICH9 Family) 2 port SATA IDE Controller (rev 02)

00:1f.2 IDE interface: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 4 port SATA IDE Controller (rev 02)

[    1.041062] ata1.00: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

[    1.041155] ata1.01: SATA link down (SStatus 0 SControl 300)

[    1.045875] ata1.00: ATA-7: WDC WD360ADFD-00NLR1, 20.07P20, max UDMA/133

[    1.045961] ata1.00: 72303840 sectors, multi 16: LBA48 NCQ (depth 0/32)

[    1.052916] ata1.00: configured for UDMA/133

[    1.053076] scsi 0:0:0:0: Direct-Access     ATA      WDC WD360ADFD-00 20.0 PQ: 0 ANSI: 5

[    1.053371] sd 0:0:0:0: [sda] 72303840 512-byte hardware sectors: (37.0 GB/34.4 GiB)

[    1.053509] sd 0:0:0:0: [sda] Write Protect is off

[    1.053590] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

[    1.053607] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    1.053796]  sda: sda1 sda2 sda3 sda4

[    1.076872] sd 0:0:0:0: [sda] Attached SCSI disk

hdparm -t /dev/sda

/dev/sda:

 Timing buffered disk reads:  142 MB in  3.02 seconds =  47.02 MB/sec

```

With AHCI enable it goes to 89 MB/s (nearly 2x), so 59 MB/s for an old PATA isn't that bad finally.

----------

## Nerevar

Thanks to both of you. I'm getting around the same numbers as krinn, so it seems to be working fine and I was able to completely disable the IDE driver.

----------

## Fog_Watch

In the end, I don't know what the solution was.

The kernel was upgraded to:

```
# uname -r

2.6.29-gentoo-r5
```

Kernel was defined as:

```
Device Drivers  --->

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

    SCSI device support  --->

        <*> SCSI disk support

        <*> SCSI CDROM support

        <*> SCSI generic support

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

        [*]   ATA SFF support

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

        < >     Generic ATA support
```

Yes, I needed a root=/dev/sda3 on the kernel line of my grub.conf.

```
# cat /proc/scsi/scsi 

Attached devices:

Host: scsi0 Channel: 00 Id: 00 Lun: 00

  Vendor: ATA      Model: FUJITSU MPF3102A Rev: 0028

  Type:   Direct-Access                    ANSI  SCSI revision: 05

Host: scsi0 Channel: 00 Id: 01 Lun: 00

  Vendor: SONY     Model: CD-RW  CRX175E   Rev: 1.0j

  Type:   CD-ROM                           ANSI  SCSI revision: 05

```

Nice.

----------

