hal9008
Posts: 8
Joined: Tue Oct 30, 2018 2:44 pm

Enable trim in a SSD or somethin similar

Wed Jan 23, 2019 1:54 pm

Hello.

My raspberry has the "boot" folder in the SD card, but all the system runs in a SSD connected in a usb port. I am running a web server and a mail server in this SSD.

Now all runs fine, but... i think that i must enable TRIM or something similar to extend the life of the SSD. I put the SSD in a standard hard drive enclosure for 2.5 drives. ¿Can I enable TRIM in this drive?

If i do lsblk -D I can see this, but i don't know if trim is enabled (I suppose that it is not enabled).

NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda 0 0B 0B 0
└─sda1 0 0B 0B 0
mmcblk0 0 4M 428M 0
├─mmcblk0p1 0 4M 428M 0
└─mmcblk0p2 0 4M 428M 0

Thanks.

jahboater
Posts: 4595
Joined: Wed Feb 04, 2015 6:38 pm

Re: Enable trim in a SSD or somethin similar

Wed Jan 23, 2019 2:06 pm

The ext4 mount option "discard" should enable trim.

I don't use it, but instead reduce the SD card writes with a couple of simple changes:
1) Use the ext4 mount option "commit=600" to flush the disk cache every 10 minutes instead of every 5 seconds.
2) Mount /tmp and /var/log as tmpfs

W. H. Heydt
Posts: 10618
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Enable trim in a SSD or somethin similar

Wed Jan 23, 2019 3:35 pm

FYI...you don't specify which model of Pi you are using. If it's a Pi2Bv1.2, Pi3B, or Pi3B+ you can boot from the SSD without an SD card at all.

Return to “Troubleshooting”