Search:  
Gentoo Wiki

SATA

This article is part of the Hardware series.
Laptops TV Tuner Cards Wireless Servers Storage Other Hardware Motherboards Related
Wikipedia has an article on:
SATA

Contents

Kernel Support

Note: If your root partition is on a SATA device you must compile SCSI and SATA support into your kernel.

First activate support for your chipset. If you don't know which chipset is on your mainboard, execute lspci to get a hint.

Linux Kernel Configuration: SATA chipset support
Device Drivers --->
    Serial ATA (prod) and Parallel ATA (experimental) drivers  --->
        # Activate support for your chipset
        # E.g. for generic AHCI support
        <*>   AHCI SATA support
Note: If you use a kernel older than 2.6.18 you find the SATA support under Device Drivers -> SCSI device support -> SCSI low-level drivers -> Serial ATA (SATA) support

For harddisk support activate this:

Linux Kernel Configuration: harddisk support
Device Drivers  --->
    SCSI device support  ---> 
        <*> SCSI device support
        <*> SCSI disk support

For a CD- or DVD burner activate this:

Linux Kernel Configuration: CD-RW / DVD-RW support
Device Drivers  --->
    SCSI device support  ---> 
        <*> SCSI device support
        <*> SCSI CDROM support
        <*> SCSI generic support
File systems  --->
    CD-ROM/DVD Filesystems  --->
        <M> ISO 9660 CDROM file system support                                               
        [*]   Microsoft Joliet CDROM extensions                                                
        [*]   Transparent decompression extension                                                  
        <M> UDF file system support           


Below is a non-comprehensive list with hints, if additional steps are needed.

Module Chipsets Note
Intel PIIX/ICH SATA support ICH7R add 'irqpoll' to the kernel line in our bootloader


Another non-comprehensive event on SATA support on gentoo: Sometimes when you compile a non generic kernel, when you boot, your system get kernel panic because it can't mount a /dev/sdZY partition and display you the valid partitions to boot as IDE, it means like hda1 hda2 etc. instead of sda1 sda2, so in grub kernel parameters line you can switch root=/dev/sdaX for /dev/hdaX and your system will boot successfully, but your kernel will handle the /dev tree as IDE device, this means that your second DATA partition /dev/sda2 will be mounted as /dev/hda2 otherwise you'll get an dev mount error..

this "error" that isn't an error at all is just an incorrect config, can be fixed disabling or build as a module de option:

Linux Kernel Configuration: Disabling Serial ATA as IDE
Device Drivers  --->
    <*> ATA/ATAPI/MFM/RLL support  ---> 
        <M>     generic/default IDE chipset support       

or

Linux Kernel Configuration: Disabling Serial ATA as IDE not support at all
Device Drivers  --->
    <*> ATA/ATAPI/MFM/RLL support  ---> 
        < >     generic/default IDE chipset support       

Software support

S.M.A.R.T. information

See this guide.

Troubleshooting

You can read dvds, if you change /usr/src/linux/include/linux/libata.h and rebuild your kernel:
Code: libata.h
   #undef ATA_ENABLE_ATAPI
Change the line above, to match the line below
   #define ATA_ENABLE_ATAPI
this is not very stable. it could be that this change requires you to deactivate your PATA controller inside the ATA section.
I did this with an ICH5 without any problems (although burning still doesn't work)



Code: libata.h
   #undef ATAPI_ENABLE_DMADIR
Change the line above, to match the line below
   #define ATAPI_ENABLE_DMADIR
With this setting I can get 82MB/s. This could still be a bit dodgey, so beware!

SiI 3112 SATA

I haven't been able to get this to work at all, I have CONFIG_BLK_DEV_SIIMAGE │ <*> Silicon Image chipset support under the ATA banner...

and I have SCSI support as described earlier.. and... my device installed is... <*> Silicon Image SATA support

I have no idea how to tell where these disks appear...


Here is my output of dmesg. I am using libata, 2.6.14.

sata_sil version 0.9
ACPI: PCI Interrupt 0000:02:09.0[A] -> GSI 19 (level, low) -> IRQ 17
ata2: SATA max UDMA/100 cmd 0xF881C080 ctl 0xF881C08A bmdma 0xF881C000 irq 17
ata3: SATA max UDMA/100 cmd 0xF881C0C0 ctl 0xF881C0CA bmdma 0xF881C008 irq 17
ata2: no device found (phy stat 00000000)
scsi1 : sata_sil
ata3: dev 0 cfg 49:2f00 82:746b 83:7f01 84:4023 85:7469 86:3c01 87:4023 88:207f
ata3: dev 0 ATA, max UDMA/133, 781422768 sectors: lba48
ata3: dev 0 configured for UDMA/100
scsi2 : sata_sil
  Vendor: ATA       Model: WDC WD4000KD-00N  Rev: 01.0
  Type:   Direct-Access                      ANSI SCSI revision: 05

Other User Comment: Do not use both the IDE Silicon Image (siimage) and the SATA Silicon Image (sata_sil) drivers. Use one or the other. If sata_sil doesn't work, use siimage. Your device will appear as a /dev/hd# instead, but it will at least work. --68.99.132.186 00:39, 13 November 2005 (GMT)

Another User Comment: I had the same Sil 3112 problem and fixed it by removing SCSI emulation and enabling SCSI disk support in my kernel. Now it shows up under /dev

TIP for SiL3112 users: If you want to enable UDMA133 for this SATA controller (UDMA100 is enabled by default instead) you have to make a little modification to the sata_sil.c kernel driver (/usr/src/linux/drivers/scsi). Replace all of the 0x3f strings for 0x7f (.udma_mask) and recompile the kernel. Do it at your own risk. This chipset is known to have problems with some disks using UDMA133, which is why its disabled. It worked perfectly for me but I didn`t get any speed improvement and probably neither will you since most hard disks throughput is not even close to 133MB/s! ;)

Another user with problems: After buying a cheap controller here in China with a 3112 (RAID BIOS says 3112A) I tried 2.6.16-someversion with no luck, then 2.6.17-someversion with no luck. My system already has VIA SATA controller on board and two drives (sda, sdb) successfully using it. The PCI expension card cannot produce any dmesg output whether I compile it in hard or as a module (i have tried, seperately, both SATA -> SATA_SIL and IDE -> SIIMAGE.) I am wondering if I have to set up the RAID array in the RAID BIOS before the controller comes alive and is visible to the driver? Somehow I doubt this as lspci shows it fine... any tips, please let me know! I can't get at my two shiny new 250GB drives :(

Found the answer! - turns out the PCI card was only starting up properly half the time - the RAID BIOS was showing only on some boots, which completely buggered up my testing. There I was thinking the errors were caused by Linux drivers, whereas really the PCI card wasn't properly booting up. No idea what causes this - BIOS config was on PCI auto/PNP-aware OS, tried fiddling with those settings, manually setting an ICQ for each PCI slot, then finally just took the card out and put it in another PCI slot (for the second time). Finally it now seems to boot every time. The new problem is that my original VIA SATA disks (sda, sdb) have now been shifted to sdc, sdd by the BIOS, and the new disks on the SiI 3112 are now sda and sdb, which has completely screwed up grub and my boot sequence... now embarking on a mission to fix this...
Done - for some reason, despite grub-install displaying the sdc drive as hd2 (which makes sense) and me therefore adding grub.conf entries as root (hd2,0) to make the system boot I actually had to change these to (hd0,0) despite the fact that BIOS (in its boot configuration) orders the drives as grub-install displayed them - ie: sda sdb would be the new drives, sdc, sdd would be the old ones. HOWEVER, i had to leave root=/dev/sdc2 as the kernel argument (didn't change this around to sda2 as per grub's config). All in all, not straightforward at all. At least it works. But leaving it at only UDMA100 (not 133 like my VIA controller).
Unstable - After finally getting the system to boot, I discovered that after copying data successfully for awhile (whether I set the machine up in RAID (mdadm + /dev/md/0 style) or a standard configuration (/dev/sda1, /dev/sdb1)) after some time the kernel would spit out errors like this:

ata2: translated ATA stat/err 0x51/04 to SCSI SK/ASC/ASCQ 0xb/00/00 ata2: status=0x51 { DriveReady SeekComplete Error } ata2: error=0x04 { DriveStatusError }. After doing some reading online I discovered a kernel list thread by someone with perhaps similar issues, after which people suggested that it was hardware, probably his motherboard. Being on an old system with no other PCI cards this was possible for me too so I went to the effort of testing the card in not one but TWO other machines. The same thing happened. If you are writing during these errors, what happens is the filesystem gets remounted read-only after the error and the whole process gets borked. After that my consoles hang forever as I try to 'ls' 'umount' etc. on said devices. I have tried on so many different motherboards and chipsets now that I am sure the device itself or the driver has a problem. I even tried disabling some extra PCI features (bus mastering or something) at one point, though it made no difference... not really impressed, I am going to buy a new card and throw this one away. 20 euro wasted.

EDIT: Just add "irqpoll" to your kernel line in the bootloader and the card will work. Tested and comproved


As of kernel version 2.6.23 Gentoo Vanilla sources:

To get the silicon image 3112 cards to work weather it be sata or sataraid you have 2 choices:

1) Go out and Buy a new card chip numbers such as sil:3124 some other sata controller maybe even a promise etc.

2) in the kernel you have to use the old drivers into your kernel, these conflict with the new libata drivers so if you have a 3112 and anouther more recent card your going to have stability problems as they wont work with each other very well. Saying this they will no doubt work but how well is anouther matter.

Anyway to do this you need to disable the

| <  > Serial ATA (prod) and Parallel ATA (experimental) drivers 

take the Star or M off completely and find the bellow:

 < * > ATA/ATAPI/MFM/RLL support


Note :: if you boot from these drives then compile them into the kernel if not as a module as you wish. Also in this section make sure you select

< * > Support for SATA (Depricated conflicts with libata SATA drivers)

( this is why you had to disable the New Libata drivers.)

And Then

< * > Sillicon Image Support

Then compile everything as normal

make && Make modules_install

Bingo your Sil3112 is working (READ THE WARNINGS IN KERNEL MENUCONFIG IT CONFLICTS WITH libata SO IF YOU NEED MORE UPDATE DRIVERS FOR SECOND CONTROLLER THINK OF COMBINING YOUR NEWR CONTROLLER WITH A NEWER CARD.)

Thats the only way i can see of getting this working stable. hope it helps

--82.5.47.72 12:36, 16 December 2007 (UTC)FireIcer

SiI 3114 SATA / CK804 Nvidia Serial ATA

Worked fine up until >=2.6.19-gentoo kernel versions. A working configuration may be forthcoming though I'm in the midst of the troubleshooting progress after a lot of work just getting the kernels to build.

Currently determined, on my nforce 4 system, that the SiI 3114 while it does exist in the system is not used unless you are using RAID, in normal (non-raid) mode you will most likely be using the sata_nv driver.

For a 2.6.20 enable the CONFIG_SATA_NV=y, if you expect to boot off of such a beast, I believe 2.6.19 has the same requirement, enabling every SATA device (as my old genkernel induced config had) worked fine as well,

the CONFIG_SATA_SIL=y is to be used if you have a RAID mode enabled of some sort with your drives.

It is good to see a line like: Linux localhost 2.6.20-gentoo #1 SMP Sun Mar 4 21:26:16 CST 2007 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ AuthenticAMD GNU/Linux

I'll be verifying 2.6.19-r6 at least then cleaning up this section, or merely watching what is done by better gentoo-wiki folk if they jump on board.


nForce Serial ATA

As of the 2.6.19 kernel, the code seems to have moved around alot. You have to get the IDE, SCSI, and ATA config right to see your devices in /dev/sdxn. Turn off the conflicting SATA driver in IDE, turn on the SATA driver in the ATA section and interestingly enough, you need the SCSI support turned on.

CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
Retrieved from "http://www.gentoo-wiki.info/SATA"

Last modified: Sat, 30 Aug 2008 22:49:00 +0000 Hits: 92,119