Post Configuration for Samsung 850 EVO SSD on Ubuntu 16.04


The Samsung Evo 850

The following post suggests that with Ubuntu 16.04 and the 850 EVO, TRIM is enabled by default.


cat /etc/cron.weekly/fstrim


# trim all mounted file systems which support it
/sbin/fstrim --all || true

and I read elsewhere, What SSD optimization are needed on latest Ubuntu version?,
David Ambarsumov's answer, that 16.04 doesn't have the -all option. So will the weekly TRIM work? I understand that the quote is that fstrim-all isn't available, but I don't know if this is the same and if fstrim –all works as intended (this could just be my nervousness and lack of understanding in this area).

Second, I read elsewhere that one should set noatime option in /etc/fstab. Is this still relevant; I don't see noatime nor relatime in that file currently?

Finally, I read, and I think this is old, that one should choose a different scheduler than the default. Is this true, and if so, which one?

Thanks for your time!!! Much of the information on SSDs is dated, and Linux and Ubuntu have made a lot progress in that time, so it's a bit confusing.

Best Answer

fstrim supports the option --all on Ubuntu 16.04.

$ lsb_release -dirc
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

$ fstrim --help

 fstrim [options] <mount point>

Discard unused blocks on a mounted filesystem.

 -a, --all           trim all mounted filesystems that are supported
 -o, --offset <num>  the offset in bytes to start discarding from
 -l, --length <num>  the number of bytes to discard
 -m, --minimum <num> the minimum extent length to discard
 -v, --verbose       print number of discarded bytes

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see fstrim(8).

By default, Ubuntu 16.04 mounts all file systems with relatime. This works much better than noatime while adding only a very small number of write operations.

Do not mess with the I/O scheduler.

For peace of mind, you can use smartctl (install it with sudo apt-get install smartmontools if needed) from time to time to check on Life_Curve_Status, SSD_Life_Left, and Lifetime_Writes_GiB:

$ sudo smartctl --all /dev/sda
Vendor Specific SMART Attributes with Thresholds:
194 Temperature_Celsius 0x0022  047   063   000    Old_age   Always       -       47 (Min/Max 21/63)
230 Life_Curve_Status   0x0013  100   100   000    Pre-fail  Always       -       100
231 SSD_Life_Left       0x0013  100   100   010    Pre-fail  Always       -       0
241 Lifetime_Writes_GiB 0x0032  000   000   000    Old_age   Always       -       388

(Life_Curve_Status and SSD_Life_Left have values in percentage points: you will want to replace the SSD when they decrease below 20% or 10%. If you can, make your terminal 132 columns before running smartctl.)

Finally, please remember that the 850 EVO is a high-quality expensive SSD from a reputable manufacturer. It is resilient and will last a long time, probably longer than any spinning disc. The only thing you can do which Samsung admits that it would help is to overprovision it a little, that is, when partitioning leave about 5% of unpartitioned space. (This will let the internal remapping / garbage collection algorithms work more efficiently; it you decide to do it then do it only when the SSD is new or after a full-disc trim or a security erase so that the overprovisioned space consists entirely of blocks known to be not in use.)

Related Question