What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Tutorial [Scripts][2025-12-01] SSD TRIM, IPSet-based Firewall & Tunnel Director, IPv6 Enhancements, WG Port Forwarder, and more

Thanks for the update! Just tried out the new ssd_trim.sh script... sadly, it failed to see my Samsung SSD which is running inside a JMicron drive enclosure:

Code:
ViktorJp@GT-AX6000-3C88:/jffs/scripts/ssd# sh ssd_trim.sh
ssd_trim: Scanning /proc/mounts for USB-backed filesystems under /tmp/mnt
ssd_trim: Skipping drive=/dev/sda (marked non-SSD) for label=ASUS-SSD mount=/tmp/mnt/ASUS-SSD part=/dev/sda1 fs=ext4 vendor_id=152d vendor_name=JMicron
ssd_trim: No suitable USB-backed mountpoints detected under /tmp/mnt; nothing to trim. Supported filesystems: ext2, ext3, ext4

Is there still a way to force it to assume that this vendor_id is a legit SSD?
Interesting, maybe some enclosures incorrectly report that they are rotational drives. Can you try rerunning the script with this check removed?


If it works fine, I will remove this check completely. It’s not really required.
 
Interesting, maybe some enclosures incorrectly report that they are rotational drives. Can you try rerunning the script with this check removed?


If it works fine, I will remove this check completely. It’s not really required.
Thanks for the help! Yep, that worked fine:

Code:
ViktorJp@GT-AX6000-3C88:/jffs/scripts/ssd# sh ssd_trim.sh
ssd_trim: Scanning /proc/mounts for USB-backed filesystems under /tmp/mnt
ssd_trim: Detected SSD candidate: label=ASUS-SSD mount=/tmp/mnt/ASUS-SSD part=/dev/sda1 fs=ext4 vendor_id=152d vendor_name=JMicron
ssd_trim: Running fstrim on /tmp/mnt/ASUS-SSD...
ssd_trim: fstrim succeeded: /tmp/mnt/ASUS-SSD: 238916677632 bytes trimmed
ssd_trim: Successfully trimmed all selected SSD mountpoints

Changes made:

Code:
            # Build rich context (we'll reuse it for all checks)
            context="label=${label} mount=${m} part=${dev} fs=${fstype} vendor_id=${vid}"
            [ -n "$manufacturer" ] && context="${context} vendor_name=${manufacturer}"

            # 2) Rotational check (skip HDDs / "rotational" devices)
 #           if ! disk_passes_rotational_check "$disk_name" "$context"; then
 #               continue
 #           fi

            # 3) Filesystem support check (TRIM only on ext2/ext3/ext4)
            if ! filesystem_supports_trim "$dev" "$fstype" "$context"; then
                continue
            fi
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top