Page 1 of 1

SSD trim possible without AHCI in BIOS?

Posted: 2012/06/14 15:46:41
by taylorkh
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.

TIA,

Ken

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.

Re: SSD trim possible without AHCI in BIOS?

Posted: 2012/06/15 19:31:58
by TrevorH
This thread seems to say that AHCI is not required for TRIM - http://forums.anandtech.com/showthread.php?t=2213775

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]
mount -o remount,discard /
[/code]

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

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

You may also see a message saying that it [u]isn't[/u] supported if it isn't.

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

Re: SSD trim possible without AHCI in BIOS?

Posted: 2012/06/15 22:15:28
by taylorkh
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 [quote]/dev/sda1 / ext4 discard,errors=remount-ro 0 1[/quote] I deleted the UUID (another story).

A look in dmsg finds [quote][ 8.332189] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro[/quote]
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
etc.

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.

Ken

Re: SSD trim possible without AHCI in BIOS?

Posted: 2012/06/16 15:48:39
by AndrewSerk
Hello,

You can determine if a drive supports TRIM with a command like this for a drive with the device location of /dev/sda:
[code]su -c 'hdparm -I /dev/sda' | grep TRIM
* Data Set Management TRIM supported
* Deterministic read data after TRIM[/code]

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

This info was taken from: http://forums.fedoraforum.org/showthread.php?t=277082
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,

SSD trim possible without AHCI in BIOS?

Posted: 2012/06/17 00:36:52
by AlanBartlett
@[b]Andrew[/b] -- 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.

Re: SSD trim possible without AHCI in BIOS?

Posted: 2012/06/18 10:34:27
by jlehtone
Edit:
I was about to propose the "reduce wear" mount options for completeness, but just noticed that Andrew's link covers them neatly.
:oops: