Topic: Idea to improved SSD handling by using TRIM
I have an idea to improve how GParted handles SSDs (and thin provisioned enterprise class storage) by using TRIM.
Make GParted use TRIM when creating and/or deleting partitions.
After creating a partition TRIM the sectors within it, before doing anything else.
(Recent versions of mkfs.ext and mkfs.xfs already TRIM the partition before creating the FS).
Immediately before deleting the partition TRIM the sectors within it.
Optionally make it configurable in a menu item, defaulting to on.
Perhaps Device --> Enable/Disable TRIM.
Use hdparm to query a disk for TRIM support.
Alternative, just always try TRIM and just ignore errors.
# hdparm -I /dev/sda | grep TRIM * Data Set Management TRIM supported (limit 8 blocks)
Use hdparm to perform the TRIM.
May need to pass multiple spans to work around underlying limit of the maximum number of sectors the disk can accept in one TRIM command.
Alternatively, open the disk device and issue the relevant ioctl() calls directly.
Look at the code in mkfs.ext[234/xfs] to see how they do it.
# hdparm --trim-sector-ranges START_SECTOR:SECTOR_COUNT --please-destroy-my-drive /dev/DISK
Documenting here for discussion / review and to allow someone else to implement it.