Statically-linked sg_vpd utility compiled in OE
There is an on-going effort to detect if USB SSDs support TRIM. In the initrd, the 'init' script uses 'hdparm' to probe for TRIM support; however, this works for SATA SSD in a USB caddy, but not NVME SSD. There is online information about using the 'sg_vpd' utility, for example:
https://www.jeffgeerling.com/blog/2020/enabling-trim-on-external-ssd-on-raspberry-pi
https://ivanb.neocities.org/blogs/y2023/fstrim
I didn't have a NVME SSD in a USB caddy, so this morning spent AU$29 for the caddy and AU$59 for a Crucial E100 NVME M.2 SSD 480GB. The cheapest SSD they had in my local computer parts store; not a long-life, very basic but good enough.
As I posted yesterday, the 'sg3-utils' package is now in the Scarthgap package repository:
- sdparm and sg3-utils compiled in OE — February 05, 2025
I experimented with the 'sg_vpd' utility, looks like 'fstrim' now
works; or rather, it ran without giving any messages and returned
zero, meaning success.
I have compiled 'sg_vpd' in OpenEmbedded, statically-linked with musl and placed it into the initrd. The OE recipe is here:
The 'sg_vpd' binary is here:
https://github.com/bkauler/woofq/tree/main/easyos/easy-arch/amd64/target/boot/initrd-tree/bin
Next up, plan to put code into the 'init' script in the
initrd.
Tags: easy