Welcome to SparkyLinux forums
Zapraszamy również na polsko-języczne Forum https://forum.linuxiarze.pl

Considering SSD on laptop with sparky

Started by xendistar, September 08, 2019, 10:42:25 AM

Previous topic - Next topic

xendistar


I am considering swapping out the old spinney hard disk and replacing it with a SSD. I keep seeing things about (running) TRIM with an SSD, if that still relevant for today's SSD's or have the SSD got better at managing there own file management and TRIM is no longer required?

lami07

Oversimplified answer for you question is '' forget about TRIM and enjoy your life''.  Just keep atleast 20% free space on partitions and built-in logic will do the rest.
Quote from: forum rulesWhen an issue has been resolved for you, please edit the original post to include <SOLVED> in the title. This provides a good indicator for users with a similar problem to check out the thread
Want to chat? Join #sparkylinux at [url="//irc.freenode.net"]irc.freenode.net[/url]

Bill Statler

I have an older SSD (Samsung 850 EVO 500GB purchased in 2015).  I don't know how things stand in 2019, but in case it's useful to someone, I'll list all the SSD-related things I did whan I installed Sparky 5 on this machine a year ago.  (I recommend backing up your drive before you try any of this!)


TRIM:

Verify that TRIM is supported:
sudo hdparm -I /dev/sda | grep TRIM
(Replace /dev/sda with wherever your SSD is.)
This should return a line of info about TRIM, something like:
Data Set Management TRIM supported (limit 8 blocks)

Run TRIM manually to make sure it works without errors:
sudo fstrim -a

Set up an automatic weekly run of fstrim -a:
1. Edit or create /etc/systemd/system/fstrim.service and add the following:
[Unit]
Description=Discard unused blocks

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -a

2. Edit or create /etc/systemd/system/fstrim.timer and add the following:
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=multi-user.target

3. Enable it:
sudo systemctl enable fstrim.timer


/etc/fstab:

Add noatime to all the partitions on the SSD (unless you're running some rare program that actually uses the access time of files). This prevents an unnecessary write to the SSD every time a file is read.

You may want to delete discard (if it's present) from all partitions on the SSD.  (It's some sort of continuous TRIM and, as of 2015, it did not work well with Samsung SSDs.  I don't know whether this is still true in 2019, but in any case, if you've set up TRIM as above, you shouldn't need discard.)


swappiness:

Check current swappiness (a parameter that determines how often the swap partition gets used):
cat /proc/sys/vm/swappiness
Typically this will be 60.

Create or edit /etc/sysctl.d/local.conf and add:
# Local system settings

# Sharply reduce the inclination to swap
vm.swappiness=1



I/O scheduler:

There's lots of argument about which scheduler is best for an SSD, and it depends somewhat on how you're using the drive, but any of the following ought to be fine:
mq-deadline
cfq
deadline

Don't use bfq because it will be slow.

To see your current I/O scheduler:
cat /sys/block/sda/queue/scheduler
(Replace sda with wherever your SSD is.)
This will return a list of available choices, with [square brackets] indicating the current selection, e.g.:
[mq-deadline] kyber none

I've never needed to change this value, so I can't tell you how to do it!

View the most recent posts on the forum