SSD Drive - Manual Trim Issues

#1

I recently disabled the discard option 4 days ago from all my drives in fstab and enabled the fstrim timer instead. I ran a manual trim command when I changed the settings and was surprised that my older 60GB SSD would require as much trimming as was in the confirmation output. Basically it trimmed the entire free space on home and root. When I ran the trim command manually after emptying my trash a short while later the numbers returned were only in the MB range (not multi GB’s as before).

sudo fstrim -v /
/: 15.3 GiB (16395841536 bytes) trimmed
[htpc@htpc1 ~]$ sudo fstrim -v /home
/home: 26.7 GiB (28678422528 bytes) trimmed
[htpc@htpc1 ~]$ sudo fstrim -v /
/: 0 B (0 bytes) trimmed
[htpc@htpc1 ~]$ sudo fstrim -v /home
/home: 819.8 MiB (859598848 bytes) trimmed
[htpc@htpc1 ~]$ sudo fstrim -v /
/: 0 B (0 bytes) trimmed
[htpc@htpc1 ~]$ sudo fstrim -v /home
/home: 414 MiB (434061312 bytes) trimmed

To retest my trim numbers I performed a reboot, and ran fstrim again. The numbers were back to 15GB & 26GB again after the reboot.

sudo fstrim -v /
/: 15.3 GiB (16395976704 bytes) trimmed
sudo fstrim -v /
/: 88.4 MiB (92725248 bytes) trimmed
 sudo fstrim -v /home
/home: 26.8 GiB (28706082816 bytes) trimmed
 sudo fstrim -v /home
/home: 0 B (0 bytes) trimmed

Is this normal behavior after running a manual trim?

0 Likes

#2

Trim should more or less run on all your free space. I assume that prior to a reboot the system function know they were just trimmed, so only apply to your new deletions. Rebooting, it does not and again trims everything not currently being used.
This is somewhat smarter than I knew it was, but probably a cause for celebration, not eyebrows.
Again, thats a kind of informed-guess, but I’ll stay in happyland until someone says otherwise - cuz it work right ? To further the joke - I cant check myself, because I’m sitting on an M$ office machine. :japanese_goblin:

[EDIT] Just adding here the advice not to run TRIM/fstrim too often. In most cases this means no more frequently than once a week, either manually or with a timer.

1 Like

#3

Glad to here you do not think this is irregular. I was unsure, as I do not usually manually trim my drives. Thanks for the quick reply.

0 Likes

#4

I really dont know for sure.
I’d love to hear a heavyweight -ahem- weigh in on it. :wink:
Maybe someone like @gohlip as I respect them as boot/drive/partition/storage-Maestro

0 Likes

#5

DO NOT RUN fstrim command OFTEN due lack of performance SSD drive and higher usage memory cells.

fstrim should be running ONCE a week. Recommend: manual or TIMER.

2 Likes

#6

I have fstrim timer set for weekly trimming. I was just checking manually to see if it needed to be run more often (as this is only a small 60GB SSD). I will keep the timer interval at a week as you advise. Thank you for your your response.

0 Likes

#7

Hey, I don’t know everything. :laughing: I only know some small things.
But as FadeMind says, I think that’s best.

Cheers.

2 Likes

#8

I know nothing :grin: but can confirm that this is the behaviour I get with manual trim.

(My suspicion is that depending on the free capacity of the drive and the number of writes that even once a month is frequent enough.)

1 Like

#9

i’m a bit puzzled why manjaro sets discard upon detection of an ssd when it’s not as reliable as using fstrim timer. it’s one of the first things I rectified after installation on both my SSD

0 Likes

#10

Just a distro specific preference I guess. I was a little surprised myself.

0 Likes

#11

This is calamares bug internal itself.

2 Likes

#12

Ah, that’s good to know. I was thinking that was Manjaro’s decision. The teams decisions are usually pretty solid, so I was wondering about that one myself. Thanks for clearing that up.

0 Likes

#13

thanks for the clarification. the autodefrag option was a little concerning too as per the comment by @eugen-b. I partitioned the drive myself rather than let calamares handle it so it is aligned properly and I could leave some additional overprovisioning space.

0 Likes