How to switch from IDE to AHCI

16,244

Solution 1

This is what worked for me.

modify: /etc/initramfs-tools/modules

add the modules (each per new line):

ahci libahci

modify then this file: /etc/initramfs-tools/initramfs.conf

and change < most > into < list>

run: update-initramfs -u

Reboot to BIOS, switch to AHCI and boot Xubuntu.

Source: https://ubuntuforums.org/archive/index.php/t-1040648.html The similar procedure works for Windows: https://winaero.com/blog/switch-from-ide-to-achi-after-installing-windows-7-or-windows-8/

Solution 2

I found a way to do it without updating initramfs. I only added a single line to /etc/modules.

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
ahci

The module libahci will be automatically loaded because the module ahci depends on it.

After rebooting the machine I entered UEFI-settings and switched the SATA-mode to AHCI. Now the system boots in AHCI-mode. There was no need to run update-grub or reinstall Grub.

Some additional information

I am using UbuntuStudio 16.04 (xfce). Enabling only AHCI-mode in BIOS/UEFI-settings led me to Grub's command line interface and the system wouldn't boot. I also read a lot of threads about the topic, many of them said it should work out of the box. This seems to be true for Ubuntu (which I had installed previously in IDE-mode too), but obviously not for Xubuntu or UbuntuStudio although I couldn't find any differences in the kernel configuration files. So it seems to depend on the distribution we use. One obvious difference during my tests were the used kernel versions (4.4 low-latency on UbuntuStudio 16.04 and 4.10 HWE on Ubuntu 16.04), so that might be a reason.

I'm using a 1 TB HDD with 64 MB cache. Checking read speed with

mook@MookPC:~$ sudo hdparm -Tt /dev/sdb
[sudo] password for mook: 

/dev/sdb:
 Timing cached reads:   10094 MB in  2.00 seconds = 5048.93 MB/sec
 Timing buffered disk reads: 550 MB in  3.00 seconds = 183.16 MB/sec

give me almost the same values in IDE-mode or AHCI-mode, but I experienced a slight faster boot-time (25s in IDE-mode, 22s in AHCI-mode) and opening a folder with a lot of images in Phototonic seems to work noticeably faster with AHCI. I also think that AHCI-mode will reduce the wear of moving parts in the HDD.

Share:
16,244
Sebastian
Author by

Sebastian

The founder and designer of www.nottelo.com, searching for right people to work with. Especially Javascript / Typescript / Angular 2 / Java developers are welcomed. Let me know via e-mail form on nottelo.com/joinus!

Updated on September 18, 2022

Comments

  • Sebastian
    Sebastian over 1 year

    I have dualboot Xubuntu 16.04.03 and Windows 7, unfortunately SATA controller is switched to IDE and I would like to switch to AHCI for better performance and didn't find out how.

    When switched BIOS option to AHCI, Xubuntu didn't boot up and I was thrown directly to BIOS again.

  • Pilot6
    Pilot6 over 6 years
    You don't need to do anything on Linux when switching from IDE to AHCi in BIOS. It is only Windows that has some setting in the registry. Linux auto detects it.
  • Sebastian
    Sebastian over 6 years
    Well, that wasn't my case. When I switched to AHCI, I got thrown back to BIOS. It looked like whole GRUB failed.
  • Pilot6
    Pilot6 over 6 years
    I didn't downvote ;-)
  • mook765
    mook765 over 6 years
    @Sebastian I think you will need to reinstall Grub after the switch to AHCI-mode. You can boot to a live-session, chroot into your install and reinstall Grub, I think worth a try. I was thinking about the switch to AHCI too, after digging a bit deeper into the topic I decided to stick with IDE-mode. The performance advantage is probably not that big and I don't need the features of AHCI (like hot-plugging drives). BTW I had the same experience, switching from IDE to AHCI in BIOS killed Grub. Good luck.
  • Sebastian
    Sebastian over 6 years
    @mook765 It seems that "my" solution I found worked just fine. I didn't have to reinstall grub, altough I run update-grub later on to change grub timeout. It might worth a try for you or didn't it work?
  • Terrance
    Terrance over 6 years
    I will be changing a host I have at home from IDE to AHCI this evening. I will let you know how it goes. This might bail me out from needing to reinstall the entire system. Well, hopefully no grub issues. =)
  • mook765
    mook765 over 6 years
    @Sebastian Then I misunderstood you, for me it sounded as if Grub will not work anymore after the switch. I found the same threads while researching before. I wasn't really sure if that would work (some people seemed to have problems). Nice that you've been able to confirm that. Are you able to recognize better performance?
  • Sebastian
    Sebastian over 6 years
    @mook765 Hard to say if better performance comes with fresh installation or AHCI which should work faster with SSD which I do have. Frankly, I don't know what's the reason :)
  • mook765
    mook765 over 6 years
    @Sebastian I believe with a SSD you will have a relevant performance boost due to Native Command Queuing. I only have HHD's, that's different. I will try to make the switch later, I have several distributions installed, that makes it a bit more tricky. Thanks for your effort.
  • Terrance
    Terrance over 6 years
    I take back my previous comment. After I told my BIOS to do AHCI, it changed my boot order. I set it back to the correct boot order and no changes were needed. No changing of the initramfs or /etc/modules. System booted without any problems after proper boot device was selected.
  • Sebastian
    Sebastian over 6 years
    I'm glad it was easier for you. The change of the boot order did not work in my case, I've tried that.