How to configure and use libata SATA / PATA drivers

From ThinkWiki
Revision as of 16:36, 16 July 2007 by Learner (Talk | contribs)
Jump to: navigation, search

How to configure and use libata SATA / PATA drivers

For now this mosty is for libata PATA drivers. Should work for SATA as well, I can't test it since I do not have an SATA based ThinkPad.

Configure your kernel as follows:


You find those in "Device / Serial ATA (prod) and Parallel ATA (experimental) drivers" and "Device Drivers / SCSI device support" in menuconfig.

You need CONFIG_ATA_PIIX for current Intel chipsets - I got the hint from Serge Belyshev out from a thread on the ck mailinglist. It is a labeled a bit misleading:

[ ]   ServerWorks Frodo / Apple K2 SATA support
[*]   Intel PIIX/ICH SATA support                     <---  there
[ ]   Marvell SATA support (HIGHLY EXPERIMENTAL)

The other PIIX related options are for older chipsets.

Above configuration should also work for SATA as well, ATA_PIIX does SATA and PATA. For T60/X60/R60/Z60 series according to Henrique de Moraes Holschuh you might also need CONFIG_SATA_AHCI.

Switching from old IDE drivers to libata drivers

I tested libata PATA drivers on ThinkPad T23 and ThinkPad T42.

You can and probably should disable the whole IDE driver subsystem ("ATA/ATAPI/MFM/RLL support") when you switch from old IDE drivers to the new libata PATA drivers:


You need to change the bootloader configuration, rename all /dev/hd* to /dev/sd*. At least upto kernel 2.6.20 you also need to add the kernel boot option atapi_enabled=1 to get out of the box working CD-ROM support. Otherwise you manually need to load the module sr_mod with modprobe sr_mod. This option will likely become the default in 2.6.21 or 2.6.22 as Henrique de Moraes Holschuh noted.

This is an example entry:

title           Debian GNU/Linux, kernel
root            (hd0,0)
kernel          /boot/vmlinuz- root=/dev/sda1 ro resume2=swap:/dev/sda5 resume=/dev/sda5 vga=792 atap

(on Debian/Ubuntu and possibly other distros you better change the kopt line and run update-grub)

You also need to change /etc/fstab. Replace any relevant dev/hd* with /dev/sd*. Better yet use labels or uuids. An example:

# Debian
LABEL=debian    /               xfs             defaults,logbufs=8      0       1
LABEL=swap      none            swap            sw                      0       2
proc            /proc           proc            defaults                0       2
LABEL=home      /home           xfs             defaults,logbufs=8      0       2

You need to set labels for your partition via specific filesystem or swapspace tools like xfs_admin -L, tune2fs -L and mkswap -L. This way fstab setup is independant of concrete device file names and thus you can switch back to old IDE drivers easily.

For the CD-ROM drive use /dev/scd0:

/dev/scd0       /cdrom          iso9660         ro,user,noauto          0       0

This should enough to get the system up and running with the new libata PATA drivers. You may need to change other configuration files that refer to device files such as /etc/hdparm.conf and possibly /etc/sysfs.conf if you set an IO scheduler there (I just removed my cfq scheduler entries as it is the default in the meanwhile.

Smartmontools and libata driven devices

For libata driven devices you should use smartmontools 5.37 and the -d sat option. An example entry for /etc/smartd.conf would be:

# Short selftest wednesday, sunday at 13 o clock.
# Long selftest thursday, 13 Uhr
# Email me on problems and use raw temperature values
/dev/sda -d sat -r 194 -a -o on -S on -n standby -m martin@deepdance -s (S/../../(3|7)/13|L/../../4/13)


Thread on linux-thinkpad mailing list