it would be nice if hdparm could get support for trimming a full device (or partition) in addition to the --trim-sector-ranges options (utilized by wiper.sh which works at the file system level). Current workaround is to get the number of sectors (and offset if targeting a partition), compute the sector ranges and feed them to hdparm. (The maximum chunk size of 65535 sectors is probably not a good splitting choice since the SSDs may only trim at offsets and length that are multiples of some k (k=16 or 32 sectors in my case, I don't remember exactly right now)).
--trim-whole-disk would probably produce a similar result like --security-erase on SSDs. I used security erase before extensively, but since the last firmware upgrade on my FTM56GX25H SSDs due to some weird BIOS interaction the security mode is frozen now after booting and security erase no longer possible, so I need a new solution to "reset" the drive. (It still works in another machine flawlessly.)
For my experiments I need to fully trim the whole device to get a clean state, I'm not interested in doing this at filesystem level like wiper.sh does.
--trim-whole-partition would work on partitions instead of devices
Also --trim-whole-disk should allow combination with -z (re-read partition table) (or include this operation by default?), re-reading the partition table should be done after trimming, of course.
Is there a possibility to invalidate all caches the operating system has for a certain device? I regularily see mkfs.xfs complaining about "there is already a filesystem on /dev/sdx2" even if the disk was fully trimmed (of reset with security erase), partition table re-read and repartitioned.