I just transferred my root and boot volumes from an SD Card to an NVMe SSD. Everything’s working.
I notice that TRIM is available, but:
I can’t tell if it’s enabled.
I don’t know how to enable it.
I don’t know if I need to enable it.
Any suggestions would be appreciated. Thanks!
That is up to the filesystem you choose to use. This
link should prove helpful.
With the command
systemctl status fstrim.timer
you can see if the timer is enabled wich triggers the service that does the actual trimming.
That was indeed helpful. It appears, somehow, TRIM is not supported on my SSD, at least according to the OS.
~]$ sudo hdparm -I /dev/sda | grep TRIM
[sudo] password for panoptitom:
SG_IO: bad/missing sense data, sb: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Apparently DISC-GRAN and DISC-MAX should have non-zero values on a TRIM-enabled drive?
Sabrent 500GB Rocket Nvme PCIe 4.0 M.2 2280 Internal SSD Solid State Drive (SB-ROCKET-NVMe4-500) | SB-ROCKET-NVMe4-500 clearly indicates this drive supports TRIM.
EDIT: The interface board DOES support TRIM. https://raspberrypiwiki.com/index.php?title=X872&mobileaction=toggle_view_desktop
Am I missing something? Am I going to ruin my SSD operating it without TRIM?
You are running the ssd as an external drive right?
Do you get the following message when you try to TRIM your external SSD?
the discard operation is not supported
We can easily overcome this by creating a udev rule in /etc/udev/rules.d
How to do it
Identify the VendorID and ProductID of your device.
in your terminal and locate your external SSD. In my case:
Bus 002 Device 005: ID 04e8:61f5 Samsung Electronics Co., Ltd Portable SSD T5
You’ll see an ID value, mine is 04e8:61f5 The VendorID is the first par…
Yeah. I mean, it’s plugged into a USB 3 port.
I’ll check out that link. Thanks!
Followed those directions (thanks,
@Darksky! ). Ran it once and it trimmed several hundred MBs.
Enabled fstimer.service. Now I’ve got this:
DISC-GRAN and DISC-MAX are just gone now, and hdparm -I isn’t exposing TRIM info, so I’m a bit concerned. But I know the drive supports TRIM, so it shouldn’t be damaged in any case.
Take a look at the
So no. Don’t even be concerned if you can not get trim to work. Simply overprovision the SSD. Meaning, when you partition it, do not allocate all of the space. How much to not allocate is up to you. This allows for greater wear leveling, extending the life of the SSD. And after all, that is the most important thing. You could use a COW filesystem, I use f2fs myself. But I am trying to warm up to btrfs.
On my side I use the command
sudo fstrim --all
it launch the trim and give you a negative answer for some disc when it is not possible.
No negatives answer on my arm devices… I hope it works
@Darksky’s tutorial worked for me, and it trimmed several hundred MBs when it ran. I’ll know in a week if the timer service works, but I’m not too worried that it won’t.
At this point I’m more concerned by the super-bright blue blinking light on the SSD interface board. Sleeping in the same room as the Pi is now slightly more aggravating than it was before.
Today I had messages that fstrim failed (fstrim.service). I had assumed the mount option
ssd incorporated enabling trim support, but it does not.
Make sure to add a
discard to the fstab mount options:
UUID=92DA-BDF9 /boot vfat defaults,noatime,discard,nofail 0 0
UUID=2b382e06-d18c-471c-81cf-493b76bca157 / btrfs defaults,noatime,ssd,discard=async,compress-force=zstd,subvol=@ 0 0
Note: vfat does not seem to support
discard=async, so just
discard will have to do.