SSD discard in fstab or fstrim from command line

Hello all

i run fake-raid on 2 ssd’s each 128gb

in ubutu forums i read put discard in fstab to trim our ssd

googled more and found several articles fstab versus fstrim

I use to “discard” in fstab but after the info on that item i changed to fstrim
first in boot.local but that took to long a time during booting
so now i run fstrim from commandline once a week.

Question is what is the right way foor SSD’s ??

run ‘fstrim -v /’ (for the root file system) from crontab.

This page should give you an idea for how to do it.

I follow the advice from one of the kernel maintainers:


discard, noatime

in the fstab.

that depend, some ssd don’t need discard… like samsung 840 pro

After reading this I wonder if either discard or trim are really needed in most situations as all they do is allow large area erases.

https://en.opensuse.org/SDB:SSD_discard_(trim)_support

They seem to effectively be quick erases which in a number of situations are of limited use. The page is old but clearly explains what they do.

John

The real question is what file format to use on an ssd disc?

Interesting video here

Watch How flash storage works | linuxconfau Episodes | Learning Videos | Blip

I can’t say as I am worried about some aspects that are stated as musts in some places. It makes sense to make as may writes as possible to a hard drive if one is available. Most writes to system tmp for instance are tiny and well within the capabilities of the ram buffer of even mediocre hard drives so will write at a pc’s full bus speed.

One interesting aspect of files formats is that I bought some 64gb usb sticks recently. One was faulty and as I thought that this may be down to the usb on my machine I formatted all of them on a windows 7 laptop my wife uses. It wouldn’t let me use ntfs only vfat. It would be interesting to know what format a windoze machine chooses to use if installed on an ssd disc. The comment about vfat on the video makes a certain amount of sense.

John

do you have a specific fact to back up your statement?

it may be that some SSDs suffer from write amplication less than others, but I think you’ll find that TRIM functionality is vital to keep an SSD in good health.

if you try to put this option in fstab for the 840, you will get a message error

discard is not supported… it’s use it’s own technologye

sorry but I think you are wrong.

there is a thing called DuraWrite which reduces the need for TRIM, but the 840 pro doesn’t have it:

if you can’t mount with “discard”, and “fstrim -v /mountpoint” fails, it suggests the kernel is missing TRIM, or the drive controller is misconfigured (many RAID controllers won’t pass through TRIM) - set to AHCI, not legacy, and not fakeraid.

things have changed a lot with more recent kernels. A lot of more recent SSDs don’t have as much hidden reserved blocks as they used to, which are there to give the garbage collector more time to work.

at work we use SSDs for some very data intensive processes and TRIM is definitely worth while. there are some excellent articles on Anandtech and ArsTechnica about SSDs and what happens when the drive thinks that all blocks are in use, i.e. the controller has to read, modify, erase and write.