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?
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.
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!)
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:
Description=Discard unused blocks
2. Edit or create /etc/systemd/system/fstrim.timer and add the following:
Description=Discard unused blocks once a week
3. Enable it:
sudo systemctl enable fstrim.timer
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.)
Check current swappiness (a parameter that determines how often the swap partition gets used):
Typically this will be 60.
Create or edit /etc/sysctl.d/local.conf and add:
# Local system settings
# Sharply reduce the inclination to swap
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:
Don't use bfq because it will be slow.
To see your current I/O 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!