Page 1 of 1

SSD and TRIM

Posted: Mon Feb 20, 2017 9:05 am
by tsapi
Good evening,

I made a fresh install of LMDE2/64 (cinnamon) on a new SSD some months ago. A couple of months later, I installed a second SSD in that PC.

My questions are:

1. Has TRIM been taken care of for the first SSD during the installation? How can I check it? If no, how should I "enable" it?

2. How should I "enable" TRIM for the second SSD I added?

Thanks a lot in advance for any help provided! :wink:

tsapi

Re: SSD and TRIM

Posted: Mon Feb 20, 2017 10:26 am
by greerd
Hi tsapi,

If you look in /etc/cron.weekly/ you should see a file called fstrim. The file contains the command '/sbin/fstrim --all || true' which should trim all mounted file systems that support it. If you feel a weekly run isn't often enough, you could move the file into the /etc/cron.daily/ directory. (which is what I did).

Cheers

Re: SSD and TRIM

Posted: Mon Feb 20, 2017 1:13 pm
by tsapi
greerd wrote: If you look in /etc/cron.weekly/ you should see a file called fstrim. The file contains the command '/sbin/fstrim --all || true' which should trim all mounted file systems that support it. If you feel a weekly run isn't often enough, you could move the file into the /etc/cron.daily/ directory. (which is what I did).
Hi greerd!
Thanx a lot for the input, but..

Code: Select all

zmpit cron.weekly # find / -name fstrim*
/sbin/fstrim
/usr/share/bash-completion/completions/fstrim
/usr/share/man/man8/fstrim.8.gz
/usr/share/doc/util-linux/examples/fstrim.timer
/usr/share/doc/util-linux/examples/fstrim.service
zmpit cron.weekly # 
So, after a bit of googling I came to the conclusion that what you are describing is the case in ubuntu distros (I am running LMDE2).

The "debian way" (which is the case for LMDE2) must be following:

Code: Select all

zmpit cron.weekly # cp /usr/share/doc/util-linux/examples/fstrim.service /etc/systemd/system
zmpit cron.weekly # cp /usr/share/doc/util-linux/examples/fstrim.timer /etc/systemd/system
zmpit cron.weekly # systemctl enable fstrim.timer
Created symlink from /etc/systemd/system/multi-user.target.wants/fstrim.timer to /etc/systemd/system/fstrim.timer.
zmpit cron.weekly # 
So I suppose the job is done, right?

Re: SSD and TRIM

Posted: Mon Feb 20, 2017 1:49 pm
by greerd
Sytemd, I didn't think of that, I'm not sure if your correct or not. Yes Ubuntu based Mint 18.1, which comes default with /etc/cron.weekly/fstrim.
I would expect that if you open a terminal and enter 'sudo fstrim -v /' and you get output, then the command I mentioned above would work if you put it in a file like so:

Code: Select all

#!/bin/sh
# trim all mounted file systems which support it
/sbin/fstrim --all || true
and made it executible of course.

See Pjotr's Linux Tips for more info.