Maker Breaks Down How the Raspberry Pi Supports TRIM on SSDs
The community discovers some fascinating hacks. One useful hack was recently shared by a Jeff Geerling, a Raspberry Pi aficionado we've had the pleasure of featuring in the past and have interviewed on our weekly show. This week, the maker shared an of how to enable TRIM on an external USB SSD using a Raspberry Pi.
What Is TRIM?
Let's get this out of the way for anyone new to using TRIM. In short, TRIM is an ATA interface command that tells an which parts of the drive are no longer being used.
When the machine idles, Active Garbage Collection will delete all of the data that's no longer in use, which is marked by the TRIM command. What Geerling has done is find a way to enable TRIM on a given SSD using a Raspberry Pi.
Enabling TRIM on an SSD Using Raspberry Pi
According to Geerling, the process for enabling TRIM within Linux is not straightforward.
"While internal microSD cards seem to support TRIM out of the box, none of the external USB drives I tested supported it out of the box. They all needed a little help," Geerling wrote.
You will need to verify TRIM is even supported on the drive before you can proceed. Geerling recommends using root access to complete the process.
If your device supports TRIM, you can follow the steps in to enable TRIM. If everything works without error, you may have to wait several seconds, depending on the size of your drive, while the operation runs.
There are additional steps you need to take in order to save the changes, otherwise, they will completely reset when you restart the Pi. You can also enable automatic trimming, so the process takes care of itself.
If you want to read more about how to enable TRIM with a Raspberry Pi, check out the on Geerling's website and be sure to follow him for more cool Pi developments.