TRIM and other maintenance tips for SSDs

AmigaOne X5000 platform specific issues related to Linux only.
Roland
Posts: 873
Joined: Tue May 02, 2017 8:23 am

Re: TRIM for PPC Linux

Post by Roland »

xeno74 wrote: Fri Apr 14, 2023 11:21 am Please don't test it if you have important files on the NTFS partition. I don't know if the bug still exists.

If you want to test it then use a new NTFS test partition.
Ok, thanks for warning...

But for me it would be more important to get fstrim to work with NTFS-3G, as I want to run trim only periodically. I tried to mount the ntfs parttion using the 'ntfs-3d' command to be sure that 3g is really in use and not the legacy one, but that did not change anything. Do you have idea why it is not working...?
- Roland -
User avatar
xeno74
Posts: 10712
Joined: Fri Mar 23, 2012 7:58 am
Contact:

Re: TRIM for PPC Linux

Post by xeno74 »

Hi Roland,

I would like to say thank you because of your hint with TRIM. This topic is very important for SSDs.
I checked my Void PPC today because it is installed on an SSD.
Unfortunately, TRIM is not activated automatically if Void runs on an SSD. I tested fstrim manually today and it works.
I installed cronie and created a cron job for fstrim.

Screenshot with further information:

Image

Thanks for the hint.

Christian
User avatar
xeno74
Posts: 10712
Joined: Fri Mar 23, 2012 7:58 am
Contact:

Re: TRIM for PPC Linux

Post by xeno74 »

For MintPPC, Fienix and Debian: To schedule a weekly TRIM of all attached capable drives, enable the .timer unit.

systemctl enable --now fstrim.timer

Output:

Code: Select all

Created symlink /etc/systemd/system/timers.target.wants/fstrim.timer → /lib/systemd/system/fstrim.timer.
systemctl status fstrim.timer

Code: Select all

systemctl status fstrim.timer
● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2023-04-18 11:02:01 CEST; 23s ago
    Trigger: Mon 2023-04-24 01:08:03 CEST; 5 days left
   Triggers: ● fstrim.service
       Docs: man:fstrim

Apr 18 11:02:01 mintppc.a-eon.tld systemd[1]: Started Discard unused blocks once a week.
systemctl status fstrim.service

Code: Select all

● fstrim.service - Discard unused blocks on filesystems from /etc/fstab
     Loaded: loaded (/lib/systemd/system/fstrim.service; static)
     Active: inactive (dead)
       Docs: man:fstrim(8)

Apr 18 10:41:10 mintppc.a-eon.tld systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Apr 18 10:42:40 mintppc.a-eon.tld fstrim[5526]: /: 235.2 GiB (252553142272 bytes) trimmed on /dev/sda3
Apr 18 10:42:40 mintppc.a-eon.tld systemd[1]: fstrim.service: Succeeded.
Apr 18 10:42:40 mintppc.a-eon.tld systemd[1]: Finished Discard unused blocks on filesystems from /etc/fstab.
Apr 18 10:42:40 mintppc.a-eon.tld systemd[1]: fstrim.service: Consumed 1.075s CPU time.
Roland
Posts: 873
Joined: Tue May 02, 2017 8:23 am

Re: TRIM and other maintenance tips for SSDs

Post by Roland »

xeno74 wrote: Tue Apr 18, 2023 10:43 am For MintPPC, Fienix and Debian: To schedule a weekly TRIM of all attached capable drives, enable the .timer unit.

systemctl enable --now fstrim.timer
Thank you for sharing this info! If you want to run fstrim monthly instead of weekly, is it enough to simply replace the paramter "Weekly" with "Monthly" in the "fstrim.timer" file?

I think this thread could be used to share all kind of tips for 'helthcare' of SSDs, in addition to TRIM. So, I slightly modified the title of this thread to better fullfill that task :-).
- Roland -
Roland
Posts: 873
Joined: Tue May 02, 2017 8:23 am

Re: TRIM for PPC Linux

Post by Roland »

Roland wrote: Mon Apr 10, 2023 11:02 am Thank you! I tested fstrim with Fienix6, and it seems to work with EXT4 partitions, but with NTFS I got this error:

Code: Select all

~$ sudo fstrim -v /media/roland/NTFS-disk   
fstrim: /media/roland/NTFS-disk: the discard operation is not supported
Iny idea how to get it to work with NTFS? I read from different sources that NTFS-3G should nowadays work with TRIM.
I got finally 'fstrim' to work also with ntfs partitions! The trick was to mount them in fstab, using 'ntfs-3g' parameter instead of 'ntfs' or 'ntfs3':

Code: Select all

LABEL=TUX    /media/TUX   ntfs-3g	  rw,user,nofail,noatime,exec,uid=1001	0	2
But the question remains: why ntfs partitions mounted simply by accessing then from caja cannot be trimmed? Is there some way to set 'ntfs-3g' the system default when mounting partitions? BTW, EXT4 partitions mounted from caja do work with fstrim.
- Roland -
User avatar
xeno74
Posts: 10712
Joined: Fri Mar 23, 2012 7:58 am
Contact:

Re: TRIM for PPC Linux

Post by xeno74 »

Roland wrote: Sun Apr 23, 2023 4:11 pm I got finally 'fstrim' to work also with ntfs partitions! The trick was to mount them in fstab, using 'ntfs-3g' parameter instead of 'ntfs' or 'ntfs3':

Code: Select all

LABEL=TUX    /media/TUX   ntfs-3g	  rw,user,nofail,noatime,exec,uid=1001	0	2
But the question remains: why ntfs partitions mounted simply by accessing then from caja cannot be trimmed? Is there some way to set 'ntfs-3g' the system default when mounting partitions? BTW, EXT4 partitions mounted from caja do work with fstrim.
Hi Roland,

Well done! Great idea with the ntfs-3g in the fstab.

Unfortunately, I don't use NTFS mounts and I don't need them so I don't have any idea about a solution but I hope you can find a solution.

Cheers,
Christian
Post Reply