Trim support on a usb ssd

Guys, how do I find out if TRIM is currently working in openwrt?
I connect my HDD BOX with an SSD drive to the usb port of the Beeline SmartBox GIGA router.
I checked the ssd parameters using hdparm and it reported that TRIM is supported.

hdparm -I /dev/sda1 |grep -i trim
* Data Set Management TRIM supported (limit 8 blocks)

After that, I formatted it into the f2fs file system and it looks like mkfs also says that trim is involved. Is that enough?


mkfs.f2fs /dev/sda1

        F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-08-24)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Trim is enabled
Info: [/dev/sda1] Disk Model: USB 3.1 Storage
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 250067599 (122103 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 5.10.146 (builder@buildhost) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r19803-9a599fee93) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP Fri Oct 14 22:44:41 2022"
Info: [/dev/sda1] Discarding device
Info: This device doesn't support BLKSECDISCARD
Info: This device doesn't support BLKDISCARD
Info: Overprovision ratio = 0.570%
Info: Overprovision segments = 702 (GC reserved = 358)
Info: format successful

fstrim -av?

fstrim -av
fstrim: /overlay: the discard operation is not supported

Do you have the package kmod-usb-storage-uas installed?

Yes, I installed this package before connecting the disk.

I also tried passing the mount directory directly to fstrim. But still the same problem..

fstrim -v /mnt/sda1
fstrim: /mnt/sda1: the discard operation is not supported

Mount:

/dev/sda1 on /mnt/sda1 type f2fs (rw,lazytime,relatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,fsync_mode=posix)

Did you ever figure this out ? I have the same issue .

In fact, I have not figured out how trim openwrt works and whether it works at all, for this reason I still use a hdd connected to the usb port of my router, instead of an ssd

This seems to be related to the fact that its a usb device . It behaves this way on my Kubunbtu 22.04 box as well .
I found this fstrim usb

I still havent gotten it to work

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.