<semi-SOLVED> I am new to SSD drives...need guidance

Chat about just about anything else
Forum rules
Do not post support questions here. Before you post read the forum rules. Topics in this forum are automatically closed 30 days after creation.
DAMIEN1307

<semi-SOLVED> I am new to SSD drives...need guidance

Post by DAMIEN1307 »

as mentioned in title, i am new to SSD.
one of my high school students that i teach linux OSs presented me with a brand new one with mounting bracket for my desktop yesterday as a present which totally floored me...lol.
my question is this, is there any easy way to find out if TRIM is enabled by default?
if not, is my code correct for running it manually once a week or so?,,,the device is mounted as "/dev/sda1", any advice is appreciated
thanks in advance...DAMIEN

Code: Select all

sudo fstrim /
PS...the temp reported on the SSD is a steady 40c, (104F), under load as well as at idle, my "spinner" was always between 28c to 32c...is 40c normal for an SSD?
Last edited by LockBot on Wed Dec 07, 2022 4:01 am, edited 3 times in total.
Reason: Topic automatically closed 30 days after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: I am new to SSD drives...need guidance

Post by rene »

fstrim is on Mint 19 (and IIRC 18) handled by a systemd timer; systemctl list-timers will/should show an fstrim.timer on a weekly schedule. A subsequent systemctl cat fstrim.service wil show that the command it runs is /sbin/fstrim -av; you can run that manually as well without any downsides; don't be surprised by the large amount of to be trimmed space it shows, nor this number not changing between subsequent invocations: it's basically simply the free space on the file system, with the SSD itself making sure to not in fact bother freeing a block which hasn't been written to since it was last freed.

Yes, nothing's wrong with 40C. The controller in an SSD does get hot but, since not overly hot, tends to not even be passively cooled. Confined to its space-limited housing, it therefore tends to in fact run a bit hotter than a well-cooled spinner in idle condition. It does make some difference if you make sure to have some airflow around it, and people sometimes experience this to be a slight problem in the case of modern M.2 slots on the back of a motherboard, but you needn't worry for SATA ones -- and certainly not at 40C. That's perfectly fine.
DAMIEN1307

Re: I am new to SSD drives...need guidance

Post by DAMIEN1307 »

sorry to say i didnt install the SSD in LM 19...i did this one with peppermint 9 respin...the 1st command showed.

Code: Select all

damien@damien ~ $ systemctl list-timers 
NEXT                         LEFT           LAST                         PASSED       
Sat 2019-01-12 12:00:41 MST  1min 50s left  Sat 2019-01-12 11:01:36 MST  57min ago    
Sun 2019-01-13 02:15:47 MST  14h left       Sat 2019-01-12 10:35:51 MST  1h 23min ago 
Sun 2019-01-13 06:22:01 MST  18h left       Sat 2019-01-12 06:36:51 MST  5h 22min ago 
Sun 2019-01-13 06:22:51 MST  18h left       Sat 2019-01-12 06:22:51 MST  5h 36min ago 
Mon 2019-01-14 00:00:00 MST  1 day 12h left Fri 2019-01-11 16:24:34 MST  19h ago      
n/a                          n/a            Sat 2019-01-12 06:08:03 MST  5h 50min ago 

6 timers listed.
Pass --all to see loaded but inactive timers, too.
the second command showed this.

Code: Select all

damien@damien ~ $ systemctl cat fstrim.service
# /lib/systemd/system/fstrim.service
[Unit]
Description=Discard unused blocks

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -av
damien@damien ~ $ 
the third command shows this...really do not know what else to do with the info harvested here. this SSD stuff is a new realm to me.

Code: Select all

damien@damien ~ $ /sbin/fstrim -av
fstrim: /: FITRIM ioctl failed: Operation not permitted
damien@damien ~ $ 
was my terminal command for manual fstrim correct in its configuration to run it manually?. the device is mounted as "/dev/sda1"

Code: Select all

sudo fstrim /
philotux

Re: I am new to SSD drives...need guidance

Post by philotux »

Code: Select all

sudo fstrim -av
will trim all the mounted fiesystem that are supported.

Code: Select all

sudo fstrim /
only the /.

Beware:
Running fstrim frequently, or even using mount -o discard,
might negatively affect the lifetime of poor-quality SSD
devices. For most desktop and server systems a sufficient
trimming frequency is once a week. Note that not all devices
support a queued trim, so each trim command incurs a perfor‐
mance penalty on whatever else might be trying to use the
disk at the time.
from man fstrim
Last edited by philotux on Sat Jan 12, 2019 3:22 pm, edited 1 time in total.
DAMIEN1307

Re: I am new to SSD drives...need guidance

Post by DAMIEN1307 »

the terminal command seem to just work great and im ok doing this manually, in fact i prefer manual control of things anyway...lol...(control freak).

it worked in less than a second...that was really fast...results below...many thanks...DAMIEN

Code: Select all

damien@damien ~ $ sudo fstrim -av
[sudo] password for damien: 
/: 1.8 GiB (1896017920 bytes) trimmed
damien@damien ~ $ 
philotux

Re: I am new to SSD drives...need guidance

Post by philotux »

We cross-posted/-edited :D
DAMIEN1307

Re: I am new to SSD drives...need guidance

Post by DAMIEN1307 »

hehehehe...guess we did...and yes, in my first post i did mention i wanted to do it once a week or so, so i guess i must have realised intuitively that wear out would be a factor, not unlike people with "windbloes" systems that constantly defrag their HDs, cant be good for longevity...lol, and of course hopefully one would never even think of defrag on an SSD, to me that sounds like a certain, early demise...thanks again...DAMIEN
philotux

Re: I am new to SSD drives...need guidance

Post by philotux »

DAMIEN1307 wrote: Sat Jan 12, 2019 3:30 pm ... defrag on an SSD, to me that sounds like a certain, early demise...
Sounds like a sure thing!

cheers
:D
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: I am new to SSD drives...need guidance

Post by rene »

Indeed sudo fstrim -av will be the preferred manual command. I otherwise of course don't know how "peppermint" configured stuff but certainly its systemctl list-timers has been rather poorly configured to not show the unit file, it seems; certainly does for me on Mint 19.1. But in any case, the mere existence of fstrim.service will imply its setup will also use systemd timers (the other choice would be cron). To be sure, try systemctl cat fstrim.timer.

Assuming you'll indeed see a weekly schedule there and if indeed you wish to run this manually (I wouldn't) you'd want to disable the timer: sudo systemctl stop fstrim.timer && sudo systemctl disable fstrim.timer.
DAMIEN1307

Re: <SOLVED> I am new to SSD drives...need guidance

Post by DAMIEN1307 »

what is this telling me then...is it on or off?

Code: Select all

damien@damien ~ $ systemctl cat fstrim.timer
# /lib/systemd/system/fstrim.timer
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

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

[Install]
WantedBy=timers.target
damien@damien ~ $ 
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: <SOLVED> I am new to SSD drives...need guidance

Post by rene »

That's only telling you that a weekly schedule is setup on your system. Whether or not it would actually be enabled would be the point of the originally advised systemctl list-timers and I'm in fact a little pissy now that Peppermint and/or systemd itself has managed to configure that in a manner so that it's utterly useless. I mean, really. For comparison, on Mint 19:

Code: Select all

rene@hp8k:~$ systemctl list-timers 
NEXT                         LEFT          LAST                         PASSED       UNIT                         ACTIVATES
Sat 2019-01-12 21:04:02 CET  30min left    Sat 2019-01-12 20:00:55 CET  33min ago    anacron.timer                anacron.service
Sun 2019-01-13 05:11:55 CET  8h left       Sat 2019-01-12 10:33:15 CET  10h ago      apt-daily.timer              apt-daily.service
Sun 2019-01-13 06:07:55 CET  9h left       Sat 2019-01-12 06:52:55 CET  13h ago      apt-daily-upgrade.timer      apt-daily-upgrade.service
Sun 2019-01-13 17:48:05 CET  21h left      Sat 2019-01-12 17:48:05 CET  2h 45min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Mon 2019-01-14 00:00:00 CET  1 day 3h left Mon 2019-01-07 00:00:25 CET  5 days ago   fstrim.timer                 fstrim.service
n/a                          n/a           Tue 2019-01-08 14:45:29 CET  4 days ago   motd-news.timer              motd-news.service
n/a                          n/a           Tue 2019-01-08 17:33:49 CET  4 days ago   ureadahead-stop.timer        ureadahead-stop.service
Anyways, seeing as how you have the timer in the first place there's little reason to assume that one of your listed enabled timers is not fstrim.timer (getting ever more pissy by even having to say things like that) so just run the stop/disable sequence to be sure it's gone.
DAMIEN1307

Re: <SOLVED> I am new to SSD drives...need guidance

Post by DAMIEN1307 »

thank you rene...i thought it was really me that wasnt understanding at all what i was reading, i guess it wasnt me, its the very poor way it was written.

your LM19 rendition you showed me was clear as a bell...the one i have makes mud look like crystal clarity...thanks to both of you here and im going to take your advice rene and just shut the damn thing off and do it manually...makes the best sense to me as well since there is no real clear cut way of knowing if its on or off...thanks again guys...DAMIEN
DAMIEN1307

Re: <SOLVED> I am new to SSD drives...need guidance

Post by DAMIEN1307 »

as a side note rene...this one is really going to get you "P O ed"...read below...lol...DAMIEN

Code: Select all

damien@damien ~ $ sudo systemctl stop fstrim.timer && sudo systemctl disable fstrim.timer.
[sudo] password for damien: 
Failed to disable unit: Unit file fstrim.timer..service does not exist.
damien@damien ~ $ 
philotux

Re: <SOLVED> I am new to SSD drives...need guidance

Post by philotux »

Looks it has a. at the end of the command:

Code: Select all

sudo systemctl disable fstrim.timer.
run again without the period at the end.
DAMIEN1307

Re: <SOLVED> I am new to SSD drives...need guidance

Post by DAMIEN1307 »

you got a good eye philotux...i missed that one...i must have over-run the code box since i know that rene put it in correctly...just re-ran it again without the (.)...results below...DAMIEN

Code: Select all

damien@damien ~ $ sudo systemctl stop fstrim.timer && sudo systemctl disable fstrim.timer
[sudo] password for damien: 
Removed /etc/systemd/system/timers.target.wants/fstrim.timer.
damien@damien ~ $ 
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: <SOLVED> I am new to SSD drives...need guidance

Post by smurphos »

You can check if a timed fstrim has been running using journalctl | grep fstrim

My output (I swapped to SSD in August)

Code: Select all

journalctl | grep fstrim
Sep 03 05:16:15 steve-HP-Pavilion-g6-Notebook-PC fstrim[992]: /home: 83.8 GiB (89968123904 bytes) trimmed
Sep 03 05:16:15 steve-HP-Pavilion-g6-Notebook-PC fstrim[992]: /: 24.1 GiB (25918345216 bytes) trimmed
Sep 11 05:36:16 steve-HP-Pavilion-g6-Notebook-PC fstrim[988]: /home: 83.8 GiB (89917333504 bytes) trimmed
Sep 11 05:36:16 steve-HP-Pavilion-g6-Notebook-PC fstrim[988]: /: 24 GiB (25781080064 bytes) trimmed
Sep 17 05:09:18 steve-HP-Pavilion-g6-Notebook-PC fstrim[984]: /home: 83.2 GiB (89315753984 bytes) trimmed
Sep 17 05:09:18 steve-HP-Pavilion-g6-Notebook-PC fstrim[984]: /: 23.5 GiB (25242152960 bytes) trimmed
Oct 02 06:07:04 steve-HP-Pavilion-g6-Notebook-PC fstrim[996]: /home: 80 GiB (85887574016 bytes) trimmed
Oct 02 06:07:04 steve-HP-Pavilion-g6-Notebook-PC fstrim[996]: /: 23.3 GiB (25045196800 bytes) trimmed
Oct 08 00:00:20 steve-HP-Pavilion-g6-Notebook-PC fstrim[13995]: /home: 79.8 GiB (85634224128 bytes) trimmed
Oct 08 00:00:20 steve-HP-Pavilion-g6-Notebook-PC fstrim[13995]: /: 22.8 GiB (24417099776 bytes) trimmed
Oct 15 05:00:43 steve-HP-Pavilion-g6-Notebook-PC fstrim[1059]: /home: 70.6 GiB (75753656320 bytes) trimmed
Oct 15 05:00:43 steve-HP-Pavilion-g6-Notebook-PC fstrim[1059]: /: 21.7 GiB (23240175616 bytes) trimmed
Oct 22 00:00:24 steve-HP-Pavilion-g6-Notebook-PC fstrim[22434]: /home: 70.6 GiB (75755122688 bytes) trimmed
Oct 22 00:00:24 steve-HP-Pavilion-g6-Notebook-PC fstrim[22434]: /: 21.3 GiB (22862716928 bytes) trimmed
Oct 29 00:00:33 steve-HP-Pavilion-g6-Notebook-PC fstrim[11597]: /home: 67 GiB (71902240768 bytes) trimmed
Oct 29 00:00:33 steve-HP-Pavilion-g6-Notebook-PC fstrim[11597]: /: 22.2 GiB (23857946624 bytes) trimmed
Nov 05 04:19:19 steve-HP-Pavilion-g6-Notebook-PC fstrim[1141]: /home: 66.8 GiB (71719473152 bytes) trimmed
Nov 05 04:19:19 steve-HP-Pavilion-g6-Notebook-PC fstrim[1141]: /: 19.2 GiB (20625874944 bytes) trimmed
Nov 12 03:42:19 steve-HP-Pavilion-g6-Notebook-PC fstrim[1143]: /home: 55.7 GiB (59834941440 bytes) trimmed
Nov 12 03:42:19 steve-HP-Pavilion-g6-Notebook-PC fstrim[1143]: /: 19.6 GiB (21067173888 bytes) trimmed
Nov 19 03:39:01 steve-HP-Pavilion-g6-Notebook-PC fstrim[1138]: /home: 55.6 GiB (59727097856 bytes) trimmed
Nov 19 03:39:01 steve-HP-Pavilion-g6-Notebook-PC fstrim[1138]: /: 19.1 GiB (20502843392 bytes) trimmed
Nov 26 00:00:33 steve-HP-Pavilion-g6-Notebook-PC fstrim[8974]: /home: 71.5 GiB (76801040384 bytes) trimmed
Nov 26 00:00:33 steve-HP-Pavilion-g6-Notebook-PC fstrim[8974]: /: 19.3 GiB (20706836480 bytes) trimmed
Dec 03 03:37:13 steve-HP-Pavilion-g6-Notebook-PC fstrim[1148]: /home: 70.7 GiB (75909373952 bytes) trimmed
Dec 03 03:37:13 steve-HP-Pavilion-g6-Notebook-PC fstrim[1148]: /: 20.4 GiB (21939933184 bytes) trimmed
Dec 10 03:27:21 steve-HP-Pavilion-g6-Notebook-PC fstrim[1148]: /home: 71.3 GiB (76570537984 bytes) trimmed
Dec 10 03:27:21 steve-HP-Pavilion-g6-Notebook-PC fstrim[1148]: /: 20 GiB (21461082112 bytes) trimmed
Dec 18 04:32:37 steve-HP-Pavilion-g6-Notebook-PC fstrim[1155]: /home: 71.2 GiB (76476035072 bytes) trimmed
Dec 18 04:32:37 steve-HP-Pavilion-g6-Notebook-PC fstrim[1155]: /: 19.7 GiB (21094588416 bytes) trimmed
Dec 24 00:00:37 steve-HP-Pavilion-g6-Notebook-PC fstrim[15755]: /home: 55.5 GiB (59613331456 bytes) trimmed
Dec 24 00:00:37 steve-HP-Pavilion-g6-Notebook-PC fstrim[15755]: /: 19.2 GiB (20626063360 bytes) trimmed
Jan 01 06:43:56 steve-HP-Pavilion-g6-Notebook-PC fstrim[1163]: /home: 55.5 GiB (59620458496 bytes) trimmed
Jan 01 06:43:56 steve-HP-Pavilion-g6-Notebook-PC fstrim[1163]: /: 19.1 GiB (20462170112 bytes) trimmed
Jan 07 00:00:30 steve-HP-Pavilion-g6-Notebook-PC fstrim[11549]: /home: 55.5 GiB (59591970816 bytes) trimmed
Jan 07 00:00:30 steve-HP-Pavilion-g6-Notebook-PC fstrim[11549]: /: 18.8 GiB (20217655296 bytes) trimmed
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
philotux

Re: <SOLVED> I am new to SSD drives...need guidance

Post by philotux »

Code: Select all

Removed /etc/systemd/system/timers.target.wants/fstrim.timer.
Well I guess this confirms the existence of the timer, if it was the purpose of the command.
You would probably need to re-enable and start it once again:
sudo systemctl enable fstrim.timer && sudo systemctl start fstrim.timer

Edit: perhaps there is a /var/log/fstrim.log as well. I am not on LM at the moment so I couldn't check.
DAMIEN1307

Re: <SOLVED> I am new to SSD drives...need guidance

Post by DAMIEN1307 »

interesting thing i just found out by removing it...once the fstrim timer was removed, i re-ran the original code that rene gave me,

Code: Select all

systemctl list-timers

and it came back more like what his looks like...when i ran it when fstrim was enabled for automatic action, the sections marked UNIT and ACTIVATES were completely missing...now when running that command after deactivating automatic fstrim it appears in the read-out...was that a systemd type error caused by the fstrim timer?...that is really confusing the heck out of me now...lol...i think i will just stick to manual control...DAMIEN

Code: Select all

NEXT                         LEFT       LAST                         PASSED       UNIT                         ACTIVATES
Sat 2019-01-12 14:04:28 MST  49min left Sat 2019-01-12 13:04:22 MST  10min ago    anacron.timer                anacron.service
Sat 2019-01-12 19:37:53 MST  6h left    Sat 2019-01-12 10:35:51 MST  2h 39min ago apt-daily.timer              apt-daily.service
Sun 2019-01-13 06:22:14 MST  17h left   Sat 2019-01-12 06:36:51 MST  6h ago       apt-daily-upgrade.timer      apt-daily-upgrade.service
Sun 2019-01-13 06:22:51 MST  17h left   Sat 2019-01-12 06:22:51 MST  6h ago       systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
n/a                          n/a        Sat 2019-01-12 06:08:03 MST  7h ago       ureadahead-stop.timer        ureadahead-stop.service

5 timers listed.
Pass --all to see loaded but inactive timers, too.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: <SOLVED> I am new to SSD drives...need guidance

Post by rene »

Sorry but I'll just throw my hands up at that one and declare myself not interested in debugging Peppermint. Had it been something sensible, sure, but in this case the issue's just that whomever provided even the possibility of depriving systemctl list-timers of showing which timer any listed timer in fact is is just in desperate need of a black eye. Which in and of itself of course seems fair indication that it's probably the systemd crowd itself rather than Peppermint, but hey, not reproducing here.

B.t.w.,

Code: Select all

damien@damien ~ $ sudo fstrim -av
[sudo] password for damien: 
/: 1.8 GiB (1896017920 bytes) trimmed
would seem to say you have 1.8GiB free on your / partition. Time to clean.
HaveaMint
Level 6
Level 6
Posts: 1085
Joined: Fri Feb 02, 2018 9:56 pm

Re: <SOLVED> I am new to SSD drives...need guidance

Post by HaveaMint »

Code: Select all

/: 1.8 GiB (1896017920 bytes) trimmed
I thought that meant that 1.8g was all that was trimmed and not free space left on the drive.
"Tune for maximum Smoke and then read the Instructions".
Locked

Return to “Open Chat”