移动 USB-NVME-SSD 碰到 Trim 错误想知道原因以及如何解决

296 天前
 skdlv

设备是 CHIPFANCIER UME NANO ,我安装了 linux 当移动办公存储使用,下班就拔回家用,整个系统在上面。用一段时间之后会有 linux 的 btrfs trim 失败提示,也就是 async unmap/discard 。

虽然使用没问题,smart 也没报错,但是我想知道这是为什么,怀疑是 UASP 协议下 JMS583 的主控兼容问题 ,但是又不懂深层具体什么原因导致。懂的大佬请赐教解答

关闭 uas 协议会识别成 512n 的磁盘而不是 4k 512e ,并且关闭 uas 无 unmap 问题

# dmesg
kernel: sd 4:0:0:0: [sda] tag#16 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
kernel: sd 4:0:0:0: [sda] tag#16 Sense Key : Illegal Request [current] 
kernel: sd 4:0:0:0: [sda] tag#16 Add. Sense: Logical block address out of range
kernel: sd 4:0:0:0: [sda] tag#16 CDB: Unmap/Read sub-channel 42 00 00 00 00 00 00 00 18 00
kernel: critical target error, dev sda, sector 108845600 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 2
# mount
/dev/sda2 on / type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=269,subvol=/rootfs)
# lsusb -tv
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/10p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 002: Dev 002, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 0bda:0411 Realtek Semiconductor Corp. Hub
    |__ Port 004: Dev 003, If 0, Class=Mass Storage, Driver=uas, 10000M
        ID 152d:0583 JMicron Technology Corp. / JMicron USA Technology Corp. JMS583Gen 2 to PCIe Gen3x2 Bridge
# lsblk --discard
NAME        DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda                0        4K       4G         0
├─sda1             0        4K       4G         0
└─sda2             0        4K       4G         0
# grep /sys/fs/btrfs/UUID/discard/*
./discard_bitmap_bytes:7436533760
./discard_bytes_saved:4769325056
./discard_extent_bytes:18189688832
./discardable_bytes:437780480
./discardable_extents:13871
./iops_limit:1000
./kbps_limit:0
./max_discard_size:67108864
# smartctl -a /dev/sda
SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        37 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    2,659,947 [1.36 TB]
Data Units Written:                 2,701,427 [1.38 TB]
Host Read Commands:                 36,026,467
Host Write Commands:                34,915,194
Controller Busy Time:               176
Power Cycles:                       259
Power On Hours:                     1,134
Unsafe Shutdowns:                   181
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               41 Celsius
Temperature Sensor 3:               38 Celsius

Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

Self-tests not supported
# fdisk -l /dev/sda
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
686 次点击
所在节点    硬件
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1013166

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX