Claiming that 14.04 will enable trim by default is only 1/2 the story.
Will the default options for TRIM be automatically compatible with the LVM and encryption layers of the standard ubuntu-system encryption?
LVM is a container and is not a filesystem so this is not an issue.
Articles worth reading:
SSDs need to be TRIMed, i. e. they need to be told which blocks the OS
considers as "unused" (i. e. from deleted files). Withouth this, the
write speed on SSDs becomes unbearably slow over time.
http://wiki.ubuntuusers.de/SSD/TRIM (German) explains the details, but this
kind of housekeeping really should happen by default. There are two
approaches to this, immediately marking the blocks as unused when
deleting a file ("discard" mount option), or calling fstrim regularly.
discard slows down deletion while a cronjob occasionally puts some
potentially unexpected IO load on the machine, so this discussion is
primarily about deciding which approach we want to do by default.
I (Martin Pitt) think that a cron approach is better. If we go with
this we need to discuss when and how to run this:
- Whats a reasonable interval (weekly/monthly/etc.)
- How to detect devices/partitions which need trimming (/proc/mounts, hdparm -I, not mounted with "discard", etc.)
Conclusion from that link in German:
- cron job on weekly basis since discard will lead to too much of a performance hit.
Only Intel and Samsung SSDs will have TRIM enabled by default in Ubuntu 14.04 because some cheap SSDs can even brick themselves when running TRIM. The contents of
/etc/cron.weekly/fstrim on 14.04 beta 2:
# call fstrim-all to trim all mounted file systems which support it
# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g. https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
This doesn't mean TRIM should only be used with Samsung and Intel SSDs, but to avoid running into issues, this is the default option for now. Note that if you already know your SSD can handle TRIM, you can bypass the vendor check by editing the
/etc/cron.weekly/fstrim file above and adding the
--no-model-check option to the last line:
exec fstrim-all --no-model-check
Alternatively, you can schedule TRIM manually a few other ways. How to do it manual.
- BUT not all SSD's are supported. Mine is not by the way (just checked)
- LSI.com has a list of compatible SSDs in this PDF.
The method to do trim is with this command:
sudo fstrim -v /
And this is also how Ubuntu does this: by creating a cronjob that does this on a weekly basis.
Executed from my own system:
rinzwind@schijfwereld:~$ sudo fstrim -v /
[sudo] password for rinzwind:
/: 93283299328 bytes were trimmed
Takes a bit of time and it does not show any progress until done.