Eugene Grosbein
2018-11-22 20:34:49 UTC
Hi!
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;
-v: for verbose mode that shows final values for the beginning offset and length.
Later options override previous ones. Then it expects a list of device names as arguments:
erase ada0
erase /dev/ada0s1
erase -b 4096 -r file.img -v /dev/da0 /dev/da1 /dev/da2
The code:
http://www.grosbein.net/freebsd/erase.c
http://www.grosbein.net/freebsd/Makefile.erase
My "mandoc" skills are very poor and English is not my native language,
so any help with manual page creation will be appreciated.
Eugene Grosbein
P.S. I realized that our kernel-level TRIM support has no connection to cam(4) nor to geom(4),
so distinct utility instead of addition to camcontrol(8) or geom(8).
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;
-v: for verbose mode that shows final values for the beginning offset and length.
Later options override previous ones. Then it expects a list of device names as arguments:
erase ada0
erase /dev/ada0s1
erase -b 4096 -r file.img -v /dev/da0 /dev/da1 /dev/da2
The code:
http://www.grosbein.net/freebsd/erase.c
http://www.grosbein.net/freebsd/Makefile.erase
My "mandoc" skills are very poor and English is not my native language,
so any help with manual page creation will be appreciated.
Eugene Grosbein
P.S. I realized that our kernel-level TRIM support has no connection to cam(4) nor to geom(4),
so distinct utility instead of addition to camcontrol(8) or geom(8).