Triming SSDs in Ubuntu

Ubuntu 14.04 generally has trim enabled for SSD hard drives. Trim ensures that the performance of SSD drives do no drop over time hence it is necessary to run the SSD maintenance job one in a week as a cron job in Ubuntu. While Ubuntu 14.04 has it enabled, my experience with it says that the default command works only for Intel & Samsung SSDs.

Here is a brief of how to enable it for all SSDs. It works generally – have tried it with transcend, Seagate, WD Digital. You can edit the following file and the following option

sudo nano /etc/cron.weekly/fstrim

#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it
set -e

# 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.
exec fstrim-all

replace the last line (exec fstrim-all by the below line

exec fstrim-all --no-model-check

save the file and you are all set. Happy trimming !!!!!!!

Advertisements

One thought on “Triming SSDs in Ubuntu

  1. This is quite risky. Given that it runs surely for intel SSDs, if I am not using intel and using some seagate or transcend or something else, I could run into trouble if I run them on production.

    Nevertheless, this is a good read

    Cheers
    Firdaus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s