SSD trim possible without AHCI in BIOS?

Issues related to hardware problems
Posts: 419
Joined: 2010/11/24 15:08:33
Location: North Carolina, USA

SSD trim possible without AHCI in BIOS?

Postby taylorkh » 2012/06/14 15:46:41

I am starting to build a 6.2 install on a new SSD drive for my Dell XPS 8000. Based on other reading it is my understanding that the computer BIOS needs to support AHCI in order to enable trim on an SSD. Can someone confirm this? The XPS offers only ATA and RAID as best I can determine. I guess I will see if there are any BIOS updates available.



p.s. My netbook does support AHCI and is set to it. But it appears that trim is not working on Ubuntu 12.04. But that is another issue.

User avatar
Forum Moderator
Posts: 20332
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SSD trim possible without AHCI in BIOS?

Postby TrevorH » 2012/06/15 19:31:58

This thread seems to say that AHCI is not required for TRIM -

TRIM support on Linux has some other requirements - first it needs you to be using ext4, second you need to edit /etc/fstab and add "discard" to the list of options for the filesystems that reside on the SSD. You can test it by running e.g.

Code: Select all

mount -o remount,discard /

Look in /var/log/messages afterwards and you will see messages about discard like so

Code: Select all

Jun 10 17:26:28 hostname kernel: EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: discard

You may also see a message saying that it isn't supported if it isn't.

Code: Select all

Jun 15 20:31:10 eee kernel: EXT4-fs warning (device dm-0): release_blocks_on_commit: discard not supported, disabling

Posts: 419
Joined: 2010/11/24 15:08:33
Location: North Carolina, USA

Re: SSD trim possible without AHCI in BIOS?

Postby taylorkh » 2012/06/15 22:15:28

Thanks TrevorH. An interesting read and links to more interesting reads.

At the moment the only SSD I have running is on my netbook. I have the sda1 partitioned as ext4 with the discard option in /etc/fstab
/dev/sda1 / ext4 discard,errors=remount-ro 0 1
I deleted the UUID (another story).

A look in dmsg finds
[ 8.332189] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro

That would seem to indicate that trim is enabled. However, I have done a test thusly:

dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct

sudo hdparm --fibmap tempfile

I find the beginning block = 3436544

sudo hdparm --read-sector 3436544 /dev/sda

which shows data

reading sector 3436544: succeeded
1c3a 909d 8901 7eea 09bc d908 0b00 14b1
486d 91f3 8616 aa63 a522 98c5 9423 5af6

I then delete the file and wait (an hour and a half now) and run hdparm again. I should see all zeros but I still see the same data. That would imply that trim is not working.

I will try this on the new SSD when I next boot it in my desktop. I am playing musical disks at the moment and only connect the SSD when I am working on my CentOS setup.


Posts: 60
Joined: 2010/11/21 03:41:16

Re: SSD trim possible without AHCI in BIOS?

Postby AndrewSerk » 2012/06/16 15:48:39


You can determine if a drive supports TRIM with a command like this for a drive with the device location of /dev/sda:

Code: Select all

su -c 'hdparm -I /dev/sda' | grep TRIM
           *   Data Set Management TRIM supported
      *   Deterministic read data after TRIM

The Asterisk '*' above indicates the feature is present.

This info was taken from:
I hope it is ok to cross post in this case as I have found this guide to be very informative and well written, Thanks Stevea

@mods If this is not ok please feel free to delete/edit my post as you see fit.

Hope this helps,

User avatar
Forum Moderator
Posts: 9310
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk

SSD trim possible without AHCI in BIOS?

Postby AlanBartlett » 2012/06/17 00:36:52

@Andrew -- We will never delete, edit or move a post that adds to a thread.

The information you have posted is quite pertinent to this thread's topic and I see no problem in you giving credit to the originator of the information.

User avatar
Posts: 1799
Joined: 2007/12/11 08:17:33
Location: Finland

Re: SSD trim possible without AHCI in BIOS?

Postby jlehtone » 2012/06/18 10:34:27

I was about to propose the "reduce wear" mount options for completeness, but just noticed that Andrew's link covers them neatly.