"discard option is not supported" - why?

[FONT=Lucida Console]Why can’t I TRIM my SSD drives? I’m not using dmcrypt or LVM.

ha11b:~ # fstrim /boot
fstrim: /boot: the discard operation is not supported

ha11b:~ # cat /etc/issue

Welcome to SUSE Linux Enterprise Server 12 SP2 (x86_64) - Kernel \r (\l).

ha11b:~ # uname -a
Linux ha11b 4.4.59-92.17-default #1 SMP Thu Apr 6 14:16:09 UTC 2017 (7bc489d) x86_64 x86_64 x86_64 GNU/Linux

ha11b:~ # df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 8.0K 16G 1% /dev
tmpfs 16G 76K 16G 1% /dev/shm
tmpfs 16G 11M 16G 1% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/md0 50G 3.2G 45G 7% /
/dev/sdc4 479M 61M 389M 14% /boot
tmpfs 3.2G 20K 3.2G 1% /run/user/0
/dev/sr1 3.2G 3.2G 0 100% /run/media/root/SLE-12-SP2-Server-DVD-x86_642192

ha11b:~ # mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=16360988k,nr_inodes=4090247,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
/dev/md0 on / type ext4 (rw,relatime,stripe=160,data=ordered)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/sdc4 on /boot type ext4 (rw,relatime,data=ordered)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=3274960k,mode=700)
gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sr1 on /run/media/root/SLE-12-SP2-Server-DVD-x86_642192 type iso9660 (ro,nosuid,nodev,relatime,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
[/FONT]

[FONT=Lucida Console]Also…

ha11b:~ # hdparm -I /dev/sdc | grep TRIM
* Data Set Management TRIM supported (limit 8 blocks)
* Deterministic read ZEROs after TRIM
[/FONT]

Hi
Trim is taken care of via the fstrim systemd timer/service these days, as well as things like disk scheduler options (dependent of disk type)?

Suggest you check it’s enabled, so you should see it has been run in the logs.

Also look at adding discard to the mount options for the ext4 partitions.

I don’t want discard in the mount options because of the performance issues.

Either way, fstrim should still work from the command line, no?

Hi
Yes it should, I have ext4 on my /boot with SLED 12 SP2 and fstrim works fine (OCZ device), / is btrfs. Both versions are the same… 2.28-44.6.1.

So I would assume the system is all up to date with packages and patches? If not;

zypper ref
zypper up
zypper up -t patch

If you add the -v option to the fstrim command no further info aside from the error?

All up to date with zypper.

ha11b:~ # fstrim -v /boot
fstrim: /boot: the discard operation is not supported

[QUOTE=forbin;38121]All up to date with zypper.

ha11b:~ # fstrim -v /boot
fstrim: /boot: the discard operation is not supported[/QUOTE]
Hi
So what model SSD is this?

smartctl -a /dev/sdc

ha11b:~ # smartctl -a /dev/sdc
smartctl 6.2 2013-11-07 r3856 [x86_64-linux-4.4.59-92.17-default] (SUSE RPM)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family: Samsung based SSDs
Device Model: Samsung SSD 840 PRO Series
Serial Number: S12SNEACB03042W
LU WWN Device Id: 5 002538 5500af75c
Firmware Version: DXM06B0Q
User Capacity: 512,110,190,592 bytes [512 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-2, ATA8-ACS T13/1699-D revision 4c
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Sun Jun 4 21:19:07 2017 PDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (53956) seconds.
Offline data collection
capabilities: (0x53) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 35) minutes.
SCT capabilities: (0x003d) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 099 099 010 Pre-fail Always - 12
9 Power_On_Hours 0x0032 092 092 000 Old_age Always - 38017
12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 262
177 Wear_Leveling_Count 0x0013 098 098 000 Pre-fail Always - 44
179 Used_Rsvd_Blk_Cnt_Tot 0x0013 099 099 010 Pre-fail Always - 12
181 Program_Fail_Cnt_Total 0x0032 100 100 010 Old_age Always - 0
182 Erase_Fail_Count_Total 0x0032 100 100 010 Old_age Always - 0
183 Runtime_Bad_Block 0x0013 099 099 010 Pre-fail Always - 12
187 Uncorrectable_Error_Cnt 0x0032 099 099 000 Old_age Always - 464
190 Airflow_Temperature_Cel 0x0032 079 060 000 Old_age Always - 21
195 ECC_Error_Rate 0x001a 200 200 000 Old_age Always - 464
199 CRC_Error_Count 0x003e 100 100 000 Old_age Always - 0
235 POR_Recovery_Count 0x0012 099 099 000 Old_age Always - 254
241 Total_LBAs_Written 0x0032 099 099 000 Old_age Always - 8410739041

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error

1 Offline Completed without error 00% 1603 -

SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
255 0 65535 Read_scanning was never started
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

Hi
Looks like it is still blacklisted due to a firmware bug…

libata-core.c:	{ "Samsung SSD 8*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |

Let me ask my SUSE Contacts if the is a change.

Supposedly the problem with libata-core.c was fixed in kernel 4.2 and higher. That’s the whole reason I went with SUSE instead of Red Hat. The latest version of Red Hat (7.3) ships with kernel 3.10, but the latest version of SUSE ships with kernel 4.4. Also, I don’t care about NCQ TRIM. Sequential TRIM is fine.

…but it isn’t working, as far as I can tell. SLES 12 SP2 uses kernel 4.4, but I still get the dreaded “the discard option is not supported” message.

Hi
Can you confirm if you opened a SR (Support Request) about this?


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.2|GNOME 3.20.2|4.4.62-18.6-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

[QUOTE=malcolmlewis;38157]Hi
Can you confirm if you opened a SR (Support Request) about this?[/QUOTE]

I did, SR 101075566381. Much to my frustration, I was told, “You are getting the error because the device is blacklisted in the kernel.The reason we blacklisted it is because there is a firmware issue with the drive that could cause data corruption with using fstrim. You will need to check with Samsung about that.”

So it seems that the tech is using outdated information. When the corruption problem was initially discovered, some people said it was caused by a Samsung firmware issue. However, it was later confirmed to be a problem with the Linux kernel itself.

Here is the blog post that started it all. As you can see, the person apologizes to Samsung after it was discovered that the issue was related to the kernel, not the Samsung firmware. (And that only makes sense. If the issue was the Samsung firmware, why would so many other SSD drives by other manufacturers also be blacklisted?)

https://blog.algolia.com/when-solid-state-drives-are-not-that-solid/

Samsung SSD’s don’t support “queued trim” (NCQ trim). For example:

# dmesg |grep -i ata3 [ 4.687496] ata3: SATA max UDMA/133 abar m2048@0xe4349000 port 0xe4349100 irq 27 [ 4.998132] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 5.001483] ata3.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out [ 5.001486] ata3.00: ACPI cmd b1/c1:00:00:00:00:a0 (DEVICE CONFIGURATION OVERLAY) filtered out [ 5.002556] ata3.00: ACPI cmd c6/00:01:00:00:00:a0 (SET MULTIPLE MODE) succeeded [ 5.002558] ata3.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out [ 5.002690] ata3.00: supports DRM functions and may not be fully accessible [ 5.007599] ata3.00: disabling queued TRIM support [ 5.007601] ata3.00: ATA-9: Samsung SSD 850 PRO 512GB, EXM04B6Q, max UDMA/133 [ 5.007602] ata3.00: 1000215216 sectors, multi 1: LBA48 NCQ (depth 31/32), AA [ 5.009217] ata3.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out [ 5.009219] ata3.00: ACPI cmd b1/c1:00:00:00:00:a0 (DEVICE CONFIGURATION OVERLAY) filtered out [ 5.010278] ata3.00: ACPI cmd c6/00:01:00:00:00:a0 (SET MULTIPLE MODE) succeeded [ 5.010280] ata3.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out [ 5.010408] ata3.00: supports DRM functions and may not be fully accessible [ 5.015317] ata3.00: disabling queued TRIM support [ 5.015373] ata3.00: configured for UDMA/133

su fstrim -v / /: 6.8 GiB (7288807424 Bytes) getrimmt

Samsung SSD 840 PRO with firmware DXM06B0Q supports sequential trim under SLED11 SP3. I tested sequential trim support in 2014 (SLED11 SP3). So there is no reason that SLED12SP2 shouldn’t support sequential trim for Samsung 840 PRO.

Please check the trim support:

http://techgage.com/article/enabling_and_testing_ssd_trim_support_under_linux/2/

Probably your machine (SATA controller) don’t support command ATA TRIM!?

Samsung SSD 840 PRO with firmware DXM06B0Q supports sequential trim under SLED12 SP2. Fstrim works fine. Checked with:

https://techgage.com/article/enabling_and_testing_ssd_trim_support_under_linux/2/