Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2018 03:34:49 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        Freebsd hackers list <freebsd-hackers@freebsd.org>
Subject:   TRIM utility
Message-ID:  <7699de57-d903-1d61-ee42-062ed312b20d@grosbein.net>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--BMWLwdDNWBlI0B1KElsFW6Prk6LfFDvG5
Content-Type: multipart/mixed; boundary="28tQcQm9tUPKBPJWQOQ20J0TXSTHRFKCN";
 protected-headers="v1"
From: Eugene Grosbein <eugen@grosbein.net>
To: Freebsd hackers list <freebsd-hackers@freebsd.org>
Message-ID: <7699de57-d903-1d61-ee42-062ed312b20d@grosbein.net>
Subject: TRIM utility

--28tQcQm9tUPKBPJWQOQ20J0TXSTHRFKCN
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: quoted-printable

Hi!

I found we have no utility capable to perform TRIM for the whole SSD devi=
ce
or arbitrary part of it, so I wrote simple one. I can't think of nice nam=
e
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 f=
ile;
-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 na=
mes 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 c=
am(4) nor to geom(4),
so distinct utility instead of addition to camcontrol(8) or geom(8).


--28tQcQm9tUPKBPJWQOQ20J0TXSTHRFKCN--

--BMWLwdDNWBlI0B1KElsFW6Prk6LfFDvG5
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJb9xL0AAoJELDNGvImmIso2SkIAJnHBVSkCE3V9mcSSgrw+D6W
q8viJSwMrgqeE/FrWp8XE5nWVEAVff2HcqcC05DRAW0ieuEAj0rCKWwbxrq/xvP0
lyhQc6nS0buX9yz5/FmwKCDOQ3AJ3mn5z9CXtg6aOhVre712eO5qnoIpIYoistsQ
Fg/ku4KbKkU9DcfYwWMxhlotkNkcIFDSxisyQY/j5CvYAxjB/i5FfHYtI+ny7ki5
C1JbZoaOMjnGwZuZ05bj0r2cMtVnOZbxrBuKIXh5nf3BWY/6tSp5Sz30M7fcY7ge
3N/J+0/sJQnXLzxNoLb9639bQ/MSyx9mPNNeVTrJZaqVLu2+vZgBStLlF8YKRKU=
=v8A5
-----END PGP SIGNATURE-----

--BMWLwdDNWBlI0B1KElsFW6Prk6LfFDvG5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7699de57-d903-1d61-ee42-062ed312b20d>