TRIM utility
Eugene Grosbein
eugen at grosbein.net
Fri Nov 23 06:59:58 UTC 2018
23.11.2018 6:20, Warner Losh wrote:
>> I found we have no utility capable to perform TRIM for the whole SSD device
>> or arbitrary part of it, so I wrote simple one. I can't think of nice name
>> for it, so proposal are welcome! Draft name is "erase".
>>
>> I ask for pre-commit code review, too.
>> The code is tested with TRIM-capable SSD and non-capable other devices.
>>
>> Currently it has four options, all of them are, hmm, optional:
>>
>> -b: to specify offset from the beginning of the device for trimmed region
>> instead of default 0;
>> -l: to specify offset from the "-b" margin - length - for trimmed region
>> instead of whole device;
>> -r rfile: for alternative way to specify length as length of referenced
>> file;
>>
>
> This seems really obscure and would be better handled by a stat command.
This is inspired by truncate(1) having same option that saves extra call to stat.
Forgot to note, that options -b and -l allow suffixes [K|k|M|m|G|g|T|t]
just like truncate's option -s does.
> "erase" is a really bad name. It's fraught with too many overloaded
> meanings. "trim" is likely the least bad name we can use.
I'm fine with this, renamed.
> Linux has a fstrim command, which does something kinda similar (it's a lot
> like fsck -E to erase unused parts of the filesystem), so there is some
> overlap. I couldn't find a dedicated command to do that, but if it does, we
> should follow that convention to reimplement.
Well, they have http://man7.org/linux/man-pages/man8/blkdiscard.8.html
I don't like the name, though. It's too complicated to pronounce and too long same time.
I can rename -b option to -o to match blkdiscard's, if this matters.
More information about the freebsd-hackers
mailing list