SSD and TRIM

Questions about hardware and drivers
Forum rules
Before you post please read how to get help
tsapi
Level 1
Level 1
Posts: 2
Joined: Mon Feb 20, 2017 8:30 am
Location: Thessaloniki, Greece

SSD and TRIM

Postby tsapi » Mon Feb 20, 2017 9:05 am

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
tsapi

greerd
Level 5
Level 5
Posts: 732
Joined: Sat Jul 31, 2010 10:58 am
Location: Nova Scotia, Canada

Re: SSD and TRIM

Postby greerd » Mon Feb 20, 2017 10:26 am

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
Image

tsapi
Level 1
Level 1
Posts: 2
Joined: Mon Feb 20, 2017 8:30 am
Location: Thessaloniki, Greece

Re: SSD and TRIM

Postby tsapi » Mon Feb 20, 2017 1:13 pm

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?
tsapi

greerd
Level 5
Level 5
Posts: 732
Joined: Sat Jul 31, 2010 10:58 am
Location: Nova Scotia, Canada

Re: SSD and TRIM

Postby greerd » Mon Feb 20, 2017 1:49 pm

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.
Image


Return to “Hardware Support”