-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Official Raspberry Pi NVMe SSD drive (Biwin) ignores TRIM commands #6627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you demonstrate a different NVMe drive producing different results? How are they different? |
@P33M trim should normally trim the nvme namespace usage:
|
I have an identically configured Pi (Ubuntu 24.04 on ZFS on root) using a different SSD model:
Here TRIM is working correctly (first Gb is much lower than second Gb). Identical kernel, however the Pi firmware is slightly older:
Apart from the firmware being slightly different, and the SSD models being different, these two Pi are configured absolutely identically using the same set of instructions. |
Exactly the same as the issue author (original 512Gb model):
trim it
after
Posting here to not just add a ➕ |
Does it claim to trim every time? And does the usage persist across reboots? |
I have the same drive (512GB BIWIN) and it doesn't claim to trim every time, on further attempts it says 0B trimmed. On reboot, it continues to show 100% usage and shows Same behaviour on a Silicon Power A60 256GB, and a Crucial P3 Plus 500GB at this point. The rest are in the office, including the 256GB Samsung-based Pi one sadly. |
Interesting. Other than the output from |
There is nothing in the kernel logs. There is nothing in the NVMe logs. As far as the kernel and filesystem is aware, the TRIM is successful. Additional data point: when you first turn on the drive and do I haven't tried it, but if one did a secure erase of the drive to completely reset it, it would be interesting to learn if There is another possibility: TRIM is working fine, but the drive does not report it correctly to In any case, I think the Pi Foundation ought to investigate. If TRIM isn't working, the longevity of these drives will be impacted never mind write performance once 'full'. |
THINP is indeed 0:
Deallocate support is mandatory, and as your testing shows, causes data to be rendered unrecoverable. |
I appreciate your feedback that a NVMe device is permitted to not reduce its reported utilisation and it's still "okay". I don't think the THINP bit has much to do with anything except that this behaviour is permitted. On my desktop machine:
I think my main concern and bugbear is how can I tell if these Biwin drives actually implement TRIM properly or not? Will they have longevity problems? Will there be write speed issues? I feel a bit annoyed because early Raspberry Pi branded NVMe SSDs were actually rebadged Samsung PM991a's and they're a great drive where you can see TRIM working correctly. If I can't see TRIM working, that gets me anxious. The Samsung PM991a is very similar money to the Raspberry Pi branded Biwin drive. Surely the advice to all Raspberry Pi owners must be "avoid the branded Biwin NVMe drive, get a Samsung PM991a instead"? I don't expect an answer to that - it is a rhetorical question. All I can say is this type of thing tends to appear on HackerNews and people get worked up. So expect more comments here maybe. Thanks for looking into this in a timely fashion. |
@ned14 - One quick note — I do remember asking Raspberry Pi about this (using different hardware underneath the sticker), and they said that's the main reason their specifications were more generic on the Raspberry Pi SSD page. The specs are a minimum, and as long as those are met, the underlying chips are interchangeable. I'm not judging whether that's a good policy or bad, but at least from their perspective, the Biwin controller meets the specifications on the tin. I think if you want a consistent experience with any SSD (whether Pi branded, Pineboards, Cytron, etc.), I would rather stick to one of the flash manufacturers directly... but even there, with the same model, this part-swapping happens!. |
@geerlingguy I guess how much this matters to you depends on use case. In my case these Pis are off to colocation in a far away data centre where they are expected to be operational for a decade. Getting physical access to them after will be expensive and time consuming. ZFS being copy on write does a LOT of writing (I have a Samsung 830 here, 100,000 hours powered on a couple of Petabytes written and going strong). Some of my concern is that there aren't many 2230 sized NVMe SSDs which don't have compatibility issues with the Pi. This is why the stamp of approval from the Pi Foundation would matter. With the benefit of hindsight and for anybody else reading this later, if you needed an ultra reliable Pi, my advice to anybody would be:
Which pretty much leaves only SSDs with genuine Samsung controllers on them (NOT Samsung branded SSDs with non-Samsung controllers), SK Hynix, Kioxia or Micron. Most of the cheaper supply off eBay are used system pulls, they tend to have 10k hours on them and a few dozen Tb of data written. Those tend to be good value for money. |
@ned14 - Yeah, I agree with you, especially wrt 2280 instead of 2230... the latter is generally only used in consumer or highly-space-constrained devices. It's think that's why many of the other entrants like Pineboards and Cytron (and now I think Argon40 as well) have gone with 2280 and sometimes 2242 sizes. |
Describe the bug
The official 512Gb Raspberry Pi NVMe SSD drive ignores TRIM commands, despite claiming to support them. Other NVMe SSD drives do not do this.
Steps to reproduce the behaviour
Linux thinks it is supported.
Apparently all space is allocated (it is not, 1.52Gb out of 457Gb is allocated). Manually force a trim:
It takes about a minute, so it's doing something.
Absolutely no change. Lets make sure it's not ZFS:
Nope,
fstrim
on the FAT boot partition also was ignored.I also have a Pi with a Samsung SM961 MZ-VPW2560 NVMe SSD also running ZFS on root. There TRIM from ZFS works perfectly.
I think your Biwin SSD either has a misconfiguration in your kernel drivers, or its firmware is buggy. If the latter, you are surely best placed to persuade Biwin to release a fixed firmware for your SSD.
Device (s)
Raspberry Pi 5
System
Ubuntu 24.04 LTS
2025/01/14 00:16:48
Copyright (c) 2012 Broadcom
version 0451f142 (release) (embedded)
Linux europe7b 6.8.0-1017-raspi #19-Ubuntu SMP PREEMPT_DYNAMIC Fri Dec 6 20:45:12 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Logs
dmesg is absolutely clean and shows no errors of any kind.
Additional context
No response
The text was updated successfully, but these errors were encountered: