Skip to content

Official Raspberry Pi NVMe SSD drive (Biwin) ignores TRIM commands #6627

@ned14

Description

@ned14

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.

0000:01:00.0 Non-Volatile memory controller: Biwin Storage Technology Co., Ltd. KingSpec NX series NVMe SSD (DRAM-less) (rev 01) (prog-if 02 [NVM Express])
        Subsystem: Biwin Storage Technology Co., Ltd. KingSpec NX series NVMe SSD (DRAM-less)
NVME Identify Controller:
vid       : 0x1dee
ssvid     : 0x1dee
sn        : 2446143801757       
mn        : BIWIN CE430T5D100-512G                  
fr        : 1.4.7.67
rab       : 2
ieee      : 50c68e
cmic      : 0
mdts      : 5
cntlid    : 0
ver       : 0x10400
rtd3r     : 0x124f80
rtd3e     : 0x2191c0
oaes      : 0
ctratt    : 0
rrls      : 0
cntrltype : 1
fguid     : 00000000-0000-0000-0000-000000000000
crdt1     : 0
crdt2     : 0
crdt3     : 0
nvmsr     : 0
vwci      : 0
mec       : 0
oacs      : 0x17
acl       : 3
aerl      : 3
frmw      : 0x18
lpa       : 0x2
elpe      : 63
npss      : 4
avscc     : 0x1
apsta     : 0x1
wctemp    : 358
cctemp    : 360
mtfa      : 0
hmpre     : 16384
hmmin     : 3072
tnvmcap   : 512110190592
unvmcap   : 0
rpmbs     : 0
edstt     : 5
dsto      : 1
fwug      : 1
kas       : 0
hctma     : 0x1
mntmt     : 323
mxtmt     : 360
sanicap   : 0
hmminds   : 256
hmmaxd    : 64
nsetidmax : 0
endgidmax : 0
anatt     : 0
anacap    : 0
anagrpmax : 0
nanagrpid : 0
pels      : 0
domainid  : 0
megcap    : 0
sqes      : 0x66
cqes      : 0x44
maxcmd    : 0
nn        : 1
oncs      : 0x14
fuses     : 0
fna       : 0
vwc       : 0x7
awun      : 0
awupf     : 0
icsvscc   : 1
nwpc      : 0
acwu      : 0
ocfs      : 0
sgls      : 0x70001
mnan      : 0
maxdna    : 0
maxcna    : 0
oaqd      : 0
subnqn    : 
ioccsz    : 0
iorcsz    : 0
icdoff    : 0
fcatt     : 0
msdbd     : 0
ofcs      : 0
ps      0 : mp:3.00W operational enlat:100 exlat:600 rrt:0 rrl:0
            rwt:0 rwl:0 idle_power:- active_power:-
            active_power_workload:-
ps      1 : mp:2.80W operational enlat:150 exlat:700 rrt:1 rrl:1
            rwt:1 rwl:1 idle_power:- active_power:-
            active_power_workload:-
ps      2 : mp:2.70W operational enlat:200 exlat:1000 rrt:2 rrl:2
            rwt:2 rwl:2 idle_power:- active_power:-
            active_power_workload:-
ps      3 : mp:0.2100W non-operational enlat:1000 exlat:13000 rrt:3 rrl:3
            rwt:3 rwl:3 idle_power:- active_power:-
            active_power_workload:-
ps      4 : mp:0.0090W non-operational enlat:2000 exlat:19000 rrt:4 rrl:4
            rwt:4 rwl:4 idle_power:- active_power:-
            active_power_workload:-

Steps to reproduce the behaviour

lsblk -D
NAME        DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
loop0              0      128K       4G         0
nvme0n1            0      512B       2T         0
├─nvme0n1p1        0      512B       2T         0
├─nvme0n1p2        0      512B       2T         0
└─nvme0n1p3        0      512B       2T         0

Linux thinks it is supported.

nvme list
Node                  Generic               SN                   Model                                    Namespace  Usage                      Format           FW Rev  
--------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
/dev/nvme0n1          /dev/ng0n1            2446143801757        BIWIN CE430T5D100-512G                   0x1        512.11  GB / 512.11  GB    512   B +  0 B   1.4.7.67

Apparently all space is allocated (it is not, 1.52Gb out of 457Gb is allocated). Manually force a trim:

zpool trim -w rpool

It takes about a minute, so it's doing something.

nvme list
Node                  Generic               SN                   Model                                    Namespace  Usage                      Format           FW Rev  
--------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
/dev/nvme0n1          /dev/ng0n1            2446143801757        BIWIN CE430T5D100-512G                   0x1        512.11  GB / 512.11  GB    512   B +  0 B   1.4.7.67

Absolutely no change. Lets make sure it's not ZFS:

fstrim -v -a
/boot/firmware: 319.5 MiB (334980608 bytes) trimmed on /dev/nvme0n1p1
nvme list
Node                  Generic               SN                   Model                                    Namespace  Usage                      Format           FW Rev  
--------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
/dev/nvme0n1          /dev/ng0n1            2446143801757        BIWIN CE430T5D100-512G                   0x1        512.11  GB / 512.11  GB    512   B +  0 B   1.4.7.67

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions