Manually trim solid-state drivers (SSDs) in Linux08 Sep 2015
Linux has a build in tool blkdiscard to trim SSDs. To trim a entire disk, use command(at your caution):
How to test? First, write some content to the disk:
echo test > /dev/sdb
Then, check the content on the disk:
dd if=/dev/sdb of=/dev/stdout bs=1024 count=1
Then, trim the disk:
Check the content once again. The content on the disk should have been removed.
How the trim command been send? Checking out the source code of blkdiscard, we can find
BLKSECDISCARD (if secure discard flag is on) or
BLKDISCARD to the disk.