SSD trim possible without AHCI in BIOS?

Issues related to hardware problems

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.

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.
taylorkh
 
Posts: 255
Joined: 2010/11/24 15:08:33
Location: North Carolina, USA

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 - 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: 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
User avatar
TrevorH
Forum Moderator
 
Posts: 9109
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

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
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
taylorkh
 
Posts: 255
Joined: 2010/11/24 15:08:33
Location: North Carolina, USA

Re: SSD trim possible without AHCI in BIOS?

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

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: 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: 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,
AndrewSerk
 
Posts: 60
Joined: 2010/11/21 03:41:16

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
AlanBartlett
Forum Moderator
 
Posts: 8975
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk

Re: SSD trim possible without AHCI in BIOS?

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

Edit:
I was about to propose the "reduce wear" mount options for completeness, but just noticed that Andrew's link covers them neatly.
:oops:
User avatar
jlehtone
 
Posts: 1431
Joined: 2007/12/11 08:17:33
Location: Finland


Return to CentOS 6 - Hardware Support

Who is online

Users browsing this forum: No registered users and 1 guest