Advertising

Author Topic: Considering SSD on laptop with sparky  (Read 193 times)

Offline xendistar

  • Newbie
  • *
  • Posts: 32
Considering SSD on laptop with sparky
« on: September 08, 2019, 10:42:25 am »

 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?

Offline lami07

  • Global Moderator
  • Full Member
  • *****
  • Posts: 113
    • Sparky Community Repos
Re: Considering SSD on laptop with sparky
« Reply #1 on: September 08, 2019, 02:59:57 pm »
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 rules
When 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 irc.freenode.net

Offline Bill Statler

  • Newbie
  • *
  • Posts: 22
Re: Considering SSD on laptop with sparky
« Reply #2 on: September 09, 2019, 08:29:09 pm »
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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
[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:
Code: [Select]
[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:
Code: [Select]
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):
Code: [Select]
cat /proc/sys/vm/swappinessTypically this will be 60.

Create or edit /etc/sysctl.d/local.conf and add:
Code: [Select]
# 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:
Code: [Select]
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!