Can't execute TRIM on Mushkin SSD

Asked by littlemike

I recently replaced my four 1TB SATA hard drives in software RAID 5 configuration on my Ubuntu 20.04 system with four 1TB SATA Mushkin SSDs (model MKNSSDS21TB). I perfomed a "dd" copy for each drive-to-drive duplication. There's two EXT 4 filesystems (/ and /home) on the RAID. The copy and install went fine and it was up and running with no problems. I then tried to ensure the weekly TRIM operation was set up (preferred over the "discard" fstab entry).

At that point, I found that fstriim would not run on the filesystems -- it returns: "fstrim: /: the discard operation is not supported". Mushkin specifications states TRIM is supported. "hdparm" reports that the drives support TRIM. The "/sys/block/sdX/device/scsi_disc/0:0:0:0:/provisioning_mode" contains "writesame_16" and "/sys/block/sdX/queue/rotational" contains "0" so the kernel has the information to know it's an SSD with TRIM support. And all the literature states TRIM is supported on linux software raid -- (mdadm)RAID456 has supported discards since 2016.

Can someone steer me in the right direction to get the TRIM operation to succeed? The performance of the drives is rapidly decreasing.

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
littlemike
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

If you run:

sudo fstrim -v /

Does it run OK?

Revision history for this message
littlemike (fletchermichael) said (last edit ):
#2

Thanks for the reply. As indicated above, I get:

"fstrim: /: the discard operation is not supported"

However, I can report I've found the problem: by default, the raid456 kernel module disables TRIM/discard. The user has to affirmatively ensure the devices support TRIM and enabling it by adding the following kernel command line parameter (via the grub config file /etc/default/grub and running update-grub):

"raid456.devices_handle_discard_safely=Y"

or putting the following in /etc/modprobe.d/raid456.conf:

"options raid456 devices_handle_discard_safely=Y"

I used the kernel command line option.
My problem is solved.