Adding AHCI support to CentOS after it was already installed in IDE mode

Sometimes when you’re using a server, you’ll notice that the disk i/o is slower than it ought to be, or is using a lot more cpu than it should be during disk i/o. In some cases, this would be because the BIOS is configured to use your sata drives in legacy IDE mode instead of the more modern and faster AHCI mode.

You may be tempted to just change the mode over to AHCI in your BIOS, but if you do that, the system will kernel panic on boot. This is because, with CentOS installed without ACHI mode enabled, it didn’t bother to include the necessary drivers for AHCI during the installation. In order to support AHCI mode, you’ll need to boot regular IDE mode, install the AHCI drivers, and then you can reboot and enable AHCI in the bios.

So without further ado…

How to install the AHCI mode drivers in an existing installation of CentOS that only has IDE support

Note before you start:

  • You’ll probably need to update /etc/fstab. Various references to /dev/hdX may not work after this fix, because they will likely be renamed to /dev/sdX. This is because IDE mode will usually name your drives /dev/hdX, and AHCI will ordinarily call them /dev/sdX. You may need to edit the file to reference the correct designations before you start.
  • You should reboot your server before running the following commands, in case there’s a lingering / waiting kernel update that hasn’t fully taken effect yet.


  • Add the line: “alias scsi_hostadapter ahci” to /etc/modprobe.conf

Next, rebuild your initrd with this command:

mkinitrd -f -v /boot/initrd-$(uname -r).ahci.img $(uname -r)

Then rename the old init.rd to a backup and mv the new one where the old one was:

mv /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak
mv /boot/initrd-$(uname -r).ahci.img /boot/initrd-$(uname -r).img

Now reboot, and edit your BIOS settings to AHCI mode, and boot up your server. You should be good to go if you followed all of the above steps.

I don’t expect any problems, but if the system kernel panics, change your motherboard settings back to IDE mode and try booting up again.

It is also possible that the /etc/fstab settings are now incorrect after the changes. You can boot into CentOS rescue mode and edit /etc/fstab to the correct values.

If you still have difficulties, you’ll need to activate the .bak file for initrd instead of the new one (this is why we create the backup above), go back to IDE mode, and roll back any /etc/fstab changes.

That’s all there is to it! You should now be able to enjoy the improved performance you can get from AHCI mode for your sata drives.

If you have any questions about this information, or want to learn about Centos dedicated servers, email us at sales [at]