Jump to content

Enabling AHCI Drive Mode for Multiboot OSs


eris0xff
 Share

1 post in this topic

Recommended Posts

I thought I'd mention something thats taken a while to configure just right. During my install of Leopard retail I noticed that it really, really likes AHCI SATA mode. That's finel because AHCI SATA mode is pretty cool and makes your SATA drive accept sophisticated SCSI commands (for better performance).

 

The downside is that if you already have other operating systems installed in the default IDE SATA mode you need to reconfigure them to operate correctly in AHCI mode. Windows XP is not too big of a deal. Just download the AHCI driver from Microsoft and follow MS's instructions carefully to apply it to the OS. Reboot with your BIOS in AHCI and all is well.

 

Linux is somewhat straightforward. The kernel just needs to be reconfigured to load the 'ahci' driver during boot to make the SATA drives available. Since a significant number of people use linux/GRUB to multiboot into Leopard I'll show you how to config RedHat-derived distros and Debian-derived distros (Ubuntu etc).

 

(the following commands need to be run as 'root' or in 'sudo' mode)

 

For redhat-like systems, do this:

 

1. Edit your /etc/mkinitrd/mkinitrd.conf file and add the following line:

 

alias scsi_hostadapter1 ahci

 

2. then re-run mkinitrd to rebuild your initrd file and install it into your boot directory. If you've never done that type 'man mkinitrd'

 

For Debian derived systems (Ubuntu etc), the solution is straightforward

 

1. Create/edit a new file called /etc/modprobe.d/local.

2. Add the following line to the this file:

 

alias scsi_hostadapter1 ahci

 

3. Save the file and type the following command

 

dpkg-reconfigure linux-image-xxxxx

 

where 'xxxxx' is the version of the linux kernel package your running. for me its:

 

linux-image-2.6.26-1-686

 

your mileage may vary.

 

Debian will rebuild your initrd (boot-time kernel drivers and config) and include the changes you've made to the local config file.

 

Reboot into BIOS. Turn on AHCI, load Linux and enjoy the performance and compatibility.

 

Make sure your system supports AHCI before trying any of this. You won't get far without it.

 

HOW IT WORKS

 

Most relatively modern linux distributions use the 'libata' library to communicate with ATA/SATA subsystems. libata considers all hard drives as SCSI drives. That's why you'll get device names like /dev/sda, /dev/sdb for each SATA channel.

 

When libata starts up, it tries to load a "glue" module called "scsi_hostadapter" to bind into the low-level disk driver (ahci in our case). When the module system sees that scsi_hostadapter resolves to 'ahci', it loads that for driver functionality. It's very likely that the 'ahci' driver is already available inside your kernel -- its just that its not bound to the scsi_hostadapter yet.

 

Note: the name 'scsi_hostadapter1' is simply the next logical adapter after the plain 'scsi_hostadapter'. If you only have one adapter you can theoretically just use it without the number. I've never tried it. scsi_hostadapter1 works just fine for me and its the only SATA adapter I have.

 

BTW: If you want to make sure your linux file systems are consistently named, regardless of device name, use the LABEL naming scheme. I had a rude awakening when I had my macs external firewire drive hooked up. Linux initialized the firewire channel and assigned /dev/sda (first drive) to the mac firewire filesytem. To say the least that didn't work.

 

So label your drive partitions and use the LABEL keyword in your FSTAB and in your grub configuration. (you can also use the volume ID, but since its a 30 character hex code its hard to remember).

 

Good luck and happy grub booting.

 

eris0xff

 

PS: If your installing a fairly recent Linux distribution *after* enabling AHCI then it shoud properly recognized AHCI mode and install the correct driver.

Link to comment
Share on other sites

 Share

×
×
  • Create New...