22

I have read of a lot of questions about SSD optimization (How do I optimize the OS for SSDs?, Installing Ubuntu on a SSD, I'm confused about SSD optimization, etc...).

Most of those questions seem outdated (3+ years old) and I am a little bit confused with all the directions the answers are taking.

So my question is : As of today, what is the general consensus about SSD optimization on Ubuntu 14.04 / 15.04 ?

Is this even needed now ?

1

4 Answers 4

19

The thing is , first most important part about SSDs is minimizing the writes to the disk, which is why people add nodiratime, noatime to the /etc/fstab file.

Second , is running TRIM which reclaims unused blocks of NAND memory back to SSD. Windows has TRIM enabled by default, AFAIK, so no one bothers there. With Ubuntu, it does have a weekly cronjob for TRIM, however for I've learned from Rinzwind's answer that the cron job only runs on Intel and Samsung SSDs. That's why you have to edit that /etc/cron.weekly/fstrim file to have exec fstrim-all --no-model-check line, so that it runs no matter what is your SSD model.

Over the recent years, this has not changed - these are still key points , minimizing writes and enabling TRIM.

Removing writes and expensive storage amount is the two factors why people also remove swap area. By default, Ubuntu creates swap partition equal to your RAM size. I have a 128 SSD and 6 GB of RAM. That means that by default Ubuntu will chop off 6 GB from 128GB, leaving 122GB for my OS, and 5% is typically reserved for root, so that leaves me 122-122*0.05=115.9 GB for myself. I might as well use that storage for something else, which is why I have only one main partition, no swap partition, but I do have a 512 MB swap file as a protective feature (not that I plan on running out of RAM, but it's always recommended to have swap)

7
  • About noatime - some applications may rely on comparing modification and access times, they may dysfunction, realtime is better and since Linux kernel 2.6.30 it is on by default, no need to set it up. You can check how your file systems were mounted running command $ cat /proc/mounts
    – Mike
    Sep 15, 2015 at 16:14
  • @Mike Just ran the cat /proc/mounts. For my disk it doesn't show relatime enabled, only noatime and nodiratime which i explicitly enabled in /etc/fstab. As for noatime , can you provide some examples of which applications rely on it ? Sep 15, 2015 at 16:21
  • 2
    Sorry for typo realtime I meant relatime.
    – Mike
    Sep 15, 2015 at 16:39
  • 2
    noatime implies nodiratime, see man mount about noatime: Do not update inode access times on this filesystem (...). This works for all inode types (directories too), so implies nodiratime. In addition, IMHO it isn't necessary to use noatime when relatime would probably won't break functionality and seems like a decent option (it is also recommended in: SSDOptimization at wiki.debian.org ).
    – Dor
    Aug 24, 2016 at 19:59
  • 2
    Continue of my previous post: ... I wrote "decent" because that how many times it happens to files that their access time is earlier than their modify time? Especially regarding kernel files and all files which are in /. According to man mount: since Linux 2.6.30, the kernel defaults to the behavior of relatime. TL;DR Since Ubuntu 16, Avoid doing anything :-)
    – Dor
    Aug 24, 2016 at 19:59
6

The only thing you may need to do is to add --no-model-check to /etc/cron.weekly/fstrim.

The line should look this way

exec fstrim-all --no-model-check   

Check that your SSD supports TRIM (almost all recent models do) by

sudo hdparm -I /dev/sda | grep "TRIM supported"

if your SSD is /dev/sda. If it does, add --no-model-check.

1
  • 1
    Basically SSDs older than 2 years might be problematic.
    – Rinzwind
    Sep 15, 2015 at 14:25
6

It works fine with SSD which supports TRIM

for 16.04 there is no

fstrim-all

simple fstrim does not have --no-model-check and it works fine with sandisk ssd

1

Generally Ubuntu supports Solid State Drives very well.
If you have an intel or a SAMSUNG SSD, automatic trim support is enabled by default.

You don't have to care about much with one exception:
You should store your personal data on a HDD to reduce the amount of writes to SSD.

3
  • personal data rarely ever gets written to
    – endolith
    Sep 15, 2016 at 1:30
  • 2
    "personal data rarely ever gets written to" except for browser cache, every document and spreadsheet you click Save, anything you download, any thing copy in to upload...
    – kmarsh
    Oct 9, 2016 at 2:38
  • Isn't that exactly the purpose of a SSD? To speed up things like browser cache, etc.? And editing documents... Well, even if you edit 20 large documents everyday, which are 1 MB each, that's a max. of 20 MB of writes a day... That's not a lot. Not worth the extra hassle to add a HDD.
    – Andreas
    Jul 20, 2018 at 8:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .