SSD care

Hi all,
I am running OpenSUSE off an SSD (a 120Gb Samsung Evo 840). I have the root on the SSD, while my /home is on a bigger mechanical disk.
Root is BTRFS while /home is XFS.

I am trying to understand what are the best policies to follow to take care of my SSD (and keep it running for as long as possible). I read a lot of posts on this forums and here is what I’m coming up with.

This is what I’m already doing:

  • I scheduled a daily TRIM job that runs the fstrim command

This is what I’m thinking to do:

  1. I see that BTRFS mount options already include “ssd”, but I think it would also be better to change realtime to noatime and add nodiratime
  2. I presently have /tmp on the SSD (it is a subvolume of root); I’m thinking about moving it to another disk
  3. I’m thinking about doing the same with /var/tmp

What do you think about 1), 2) and 3)? Should I proceed?
Is there something I should take care of when implementing step 2) and 3)?
Is there something else you would do to avoid tearing of the SSD?

Thank you in advance.
Cris

On Sat 26 Dec 2015 12:56:02 AM CST, Cris70 wrote:

Hi all,
I am running OpenSUSE off an SSD (a 120Gb Samsung Evo 840). I have the
root on the SSD, while my /home is on a bigger mechanical disk.
Root is BTRFS while /home is XFS.

I am trying to understand what are the best policies to follow to take
care of my SSD (and keep it running for as long as possible). I read a
lot of posts on this forums and here is what I’m coming up with.

This is what I’m already doing:

  • I scheduled a daily TRIM job that runs the fstrim command

This is what I’m thinking to do:

  1. I see that BTRFS mount options already include “ssd”, but I think it
    would also be better to change realtime to noatime and add nodiratime
  2. I presently have /tmp on the SSD (it is a subvolume of root); I’m
    thinking about moving it to another disk
  3. I’m thinking about doing the same with /var/tmp

What do you think about 1), 2) and 3)? Should I proceed?
Is there something I should take care of when implementing step 2) and
3)?
Is there something else you would do to avoid tearing of the SSD?

Thank you in advance.
Cris

Hi
You shouldn’t need a trim job, this is already taken care of by the
system (well on Leap anyway) via a softlink in cron.

Follow the guidelines here esp since you have rotating drive;
https://en.opensuse.org/SDB:SSD_performance

Never worried about tmp or anything else, it’s a disk it’s meant to be
used… plus since your running Tumbleweed your writing to the SSD
will be above an average openSUSE install…


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 | GNOME 3.10.1 | 3.12.51-52.31-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Thank you malcolmlewis for your reply.

I only see btrfs scrub and btrfs balance being run here by cron. Nothing regarding trim.

](https://en.opensuse.org/SDB:SSD_performance)
Thank you! This is very valuable information. However, the article is quite outdated and most of the things said there are already taken care of by the standard Tumbleweed installation (e.g. I see that tumbleweed automatically selected “deadline” as the scheduler for the SSD).
This is very good news however.

Well, that’s not what is written on the article that you pointed me to. It explicitly recommends putting temp data on a TMPFS.
However, that makes me wonder about Tumbleweed’s policy about cleaning the /tmp directory. The article says that OpenSUSE will wipe it at every boot, but that’s not what I’m seeing. Actually, today I can see files dated 23-11-2015 in my /tmp.
Do you know how often (if at all) is /tmp supposed to be cleaned on Tumbleweed? I do not find a cron job for that and /etc/tmpfiles.d is empty.

Thank you in advance.
Cris

Replying to myself: there is NO policy for cleaning tmp files on Tumbleweed.

I see this in /usr/lib/tmpfiles.d/tmp.conf:

...
# Clear tmp directories separately, to make them easier to override
# SUSE policy: we don't clean those directories
...

Cris

To configure clearing /tmp, etc at boot

cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfile.d/tmp.conf

This file will now overrule the original. I have in it

D /tmp 1777 root root 1d
D /var/tmp 1777 root root 1d

which will clear /tmp aand /var/tmp.

See also

man tmpfiles.d

Hi
On openSUSE Leap 42.1 (MacBook3,1 and OCZ Vertex460A) I see;


 ls /etc/cron.weekly/
btrfs-balance.sh  btrfs-trim.sh

ls /etc/cron.monthly/
btrfs-scrub.sh

ls -la /etc/cron.weekly/
total 8
drwxr-xr-x 1 root root   58 Oct 29 15:35 .
drwxr-xr-x 1 root root 5100 Dec 26 17:15 ..
lrwxrwxrwx 1 root root   44 Oct 29 15:35 btrfs-balance.sh -> /usr/share/btrfsmaintenance/btrfs-balance.sh
lrwxrwxrwx 1 root root   41 Oct 29 15:35 btrfs-trim.sh -> /usr/share/btrfsmaintenance/btrfs-trim.sh

Maybe it doesn’t run with mixed disks? Else create your own softlink as above.

Yes, the article may be old, but still relevant, also check the SSD manufacturers website and specs for any other tweaks, firmware updates etc.

Never worried about /tmp so can’t comment.

Hi malcolmlewis!

I don’t have that symlink here (btrfs-trim.sh).
I was about to create it, but then I found a note in /etc/sysconfig/btrfsmaintenance (red and underlined by me):

## Path:           System/File systems/btrfs
## Description:    Configuration for periodic fstrim
## Type:           string(none,daily,weekly,monthly)
## Default:        "none"
## ServiceRestart: btrfsmaintenance-refresh
#
# Frequency of periodic trim. Off by default so it does not collide with
# fstrim.timer . If you do not use the timer, turn it on here. The recommended
# period is 'weekly'.
BTRFS_TRIM_PERIOD="none"

So I did a little research on fstrim.timer. I discovered that, on Tumbleweed, there was a recent (snapshot 20151214) change regarding this:


==== systemd-presets-branding-openSUSE ====

- Enable fstrim.timer and disable fstrim.service. TRIM should be
  performed once a week and not on every boot (FATE#317727).
  http://www.spinics.net/lists/util-linux-ng/msg09133.html

So I decided to enable the timer and start it, with the following two commands:

$ systemctl enable fstrim.timer
$ systemctl start fstrim.timer

I am reporting this because I think it may be of some help to others, and also to have it documented somewhere.

Cris

Hi
Well spotted! The differences between Leap and Tumbleweed :wink:

Add it to the SDB article which you should be able to edit…

Hi malcolmlewis!

Which one should I modify? This one or this one?

I can modify them, but they’re both outdated: they don’t deal with Leap nor Tumbleweed. The most recent openSUSE release to be dealt with is 11.4.
I’m not sure how I should proceed.

Cris

Hi
This one;
https://en.opensuse.org/SDB:SSD%20performance

You can add a Tumbleweed entry in the list at the beginning.