Why isn't discard automatic for SSDs?

I was surprised to find that the discard option still isn't added automatically to my fstab, even though I have an SSD. Thus I have to follow these instructions to add it.

Why doesn't the installer do this automatically? Is there some hidden drawback to using discard? Are there issues reliably detecting SSDs?


My answer here mentions the why, but for the specific reasons to not enable it by default, comes down to several important factors that affect different hardware, hardware configurations and software configurations but they basically boil down to:

  • What file system to use? (Not all filesystems support TRIM. In fact, only a small group of filesystems support TRIM including ext4 and btrfs)

  • What SSD to use? (Some are not good with TRIM. Some don't need TRIM)

  • Will RAID be used? (There are several RAID issues when using TRIM)

  • What performance impact will it have? (Negative, Positive. This varies depending on SSD, hardware, RAID configuration...)

So I guess with all of this doubts, the option for one to test it out ourselves is left with the manual approach and to see if there is an actual benefit. I can say that the benefit in an Intel 520 with and without Trim is very little, at least in my case. But still, with all of this performance issues, enabling automatic TRIM even will all of the hype about it would still be a bad idea because for some users it will be good, but for others it could be very bad.


I came across information that says it is VERY IMPORTANT TO DISABLE DISCARD MOUNT OPTION on SSD's (-o nodiscard) under Linux. Here's the quote and link:

Link:

https://www.intel.com/content/dam/support/us/en/documents/ssdc/data-center-ssds/Intel_Linux_NVMe_Guide_330602-002.pdf

Quote from page 6:

"Filesystem Recommendations

IMPORTANT: Do not discard blocks in filesystem usage.

Be sure to turn off the discard option when making your Linux filesystem. You want to allow the SSD manage blocks and its activity between the NVM (non-volatile memory) and host with more advanced and consistent approaches in the SSD Controller.

Core Filesystems:

• ext4 – the default extended option is not to discard blocks at filesystem make time, retain this, and do not add the “discard” extended option as some information will tell you to do.

• xfs – with mkfs.xfs, add the –K option so that you do not discard blocks.

If you are going to use a software RAID, it is recommended to use a chunk size of 128k as starting point, depending on the workload you are going to run. You must always test your workload."

As you can see, the manufacturer itself, Intel, makes the point SO STRONGLY that they repeat it FIVE times in the text, FOUR explicitly and one through logic that professionals understand. This is VERY EMPHATIC of the manufacturer. Also, this SSD is no slouch: it is the $1,200 Intel SSD's from a few years ago.