TRIM Command Not Supported via SAS2008 HBA?

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

mattlach

Active Member
Aug 1, 2014
323
89
28
Hey all,

I recently rearranged some drives in my server. Some SSD's whcihc I previously had attached to the on board SATA connectors, are now connected via a SFF8087 to SATA breakout cable hooked up to a LSI SAS2008 controller (IBM M1015 flashed to IT mode)

My root account has a cron job which runs fstrim on the SSD's nightly to keep them ready for new writes.

It used to work fine, but ever since moving the drives, this no longer the case. I get the "the discard operation is not supported" error message.

Is the TRIM command not supported via these older LSI SAS HBA's? Or is there maybe something else going on here?

Many thanks,
Matt
 

RTM

Well-Known Member
Jan 26, 2014
956
359
63
I can't tell you whether the SAS2008 with IT firmware supports TRIM or not (but I suspect it does).

However, I do have some other suggestions, but first of all, since you haven't given much information about OS and filesystems in use, I will assume you are using Linux and some filesystem other than ZFS (apparently TRIM on ZFS is rather new) given you mention fstrim and cron.

You could try adding the "discard" option to your mount options under /etc/fstab

The other suggestions would be to consider updating (or possibly even downgrading) the firmware, I assume there may be changes that could affect TRIM.
 

mattlach

Active Member
Aug 1, 2014
323
89
28
I can't tell you whether the SAS2008 with IT firmware supports TRIM or not (but I suspect it does).

However, I do have some other suggestions, but first of all, since you haven't given much information about OS and filesystems in use, I will assume you are using Linux and some filesystem other than ZFS (apparently TRIM on ZFS is rather new) given you mention fstrim and cron.

You could try adding the "discard" option to your mount options under /etc/fstab

The other suggestions would be to consider updating (or possibly even downgrading) the firmware, I assume there may be changes that could affect TRIM.

Thank you,

My bad. While most filesystems on this server are indeed ZFS, the one I am trying to fstrim is one of the few non-ZFS filesystems. It is ext4.

I have been told that you pretty much cant mess with the firmware on LSI controllers. That the firmware "phase" on the controller always must exactly match the "phase" of the driver module, or to expect trouble (like corruption, etc)
 

mattlach

Active Member
Aug 1, 2014
323
89
28
Trim is not support in 2008, only the new 3008 support trim.
Try sg_unmap that's SAS's version of trim.

Broadcom Inc. | Connecting Everything
looks like even after replacing my old SAS2008 era HBA's with 9300-8i HBA's in IT mode, neither fstrim (for individual drives) nor zpool trim (for ZFS storage pools) works. :(

zpool trim just fails silently (trim never initializes). Fstrim gives the following error message:

Code:
fstrim: /mnt/mythbuntu/live1: the discard operation is not supported
The drives are Samsung drives. Their specs claim full trim support.
 

mattlach

Active Member
Aug 1, 2014
323
89
28
Are you using LVM and/or LUKS by any chance?
I appreciate your response, but no, I do not think so.

My standalone drive that is having the issue is mounted via UUID in /etc/fstab. I added it manually, and never intentionally set up any LVM or LUKS.

The pool that is having issues under ZFS on Linux is pointing directly at the block devices via the symlinks in /dev/disk/by-id/ata*

There is another pool identically configured to the one having the issues, except that it is connected via the on-board sata ports. It accepts a "zpool trim" command without any issue.
 

vangoose

Active Member
May 21, 2019
326
104
43
Canada
Here is what the Broadcom KB says

The drives must support both “Data Set Management TRIM supported (limit 8 blocks)” and “Deterministic read ZEROs after TRIM” in their ATA options.
The Samsung 850 PROs don’t have “Deterministic read ZEROs after TRIM” support, and thus TRIM cannot be run on these drives when attached to a LSI SAS HBAs with IT firmware
 

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,394
511
113
I appreciate your response, but no, I do not think so.

My standalone drive that is having the issue is mounted via UUID in /etc/fstab. I added it manually, and never intentionally set up any LVM or LUKS.
Fair enough, just that filesystems sitting on top of these need to have them configured to pass through the TRIM/UNMAP commands - out of the box those are usually blocked (depending on distro IIRC).

As per vangoose's post though, sounds like he's on to something there. I hadn't heard of the necessity for DRAT and I don't use many Samsung drives so haven't run into this myself but seems to have been lots of natter about it over the years.
 

mattlach

Active Member
Aug 1, 2014
323
89
28
Here is what the Broadcom KB says

The drives must support both “Data Set Management TRIM supported (limit 8 blocks)” and “Deterministic read ZEROs after TRIM” in their ATA options.
The Samsung 850 PROs don’t have “Deterministic read ZEROs after TRIM” support, and thus TRIM cannot be run on these drives when attached to a LSI SAS HBAs with IT firmware
Interesting.

Sounds like one of those good old "we intentionally sabotaged it so you have to buy the enterprise version" deals. :p

Good to know. Thanks.
 
Last edited: