From owner-freebsd-hackers@freebsd.org Sat Nov 24 17:05:23 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 690CF110466C for ; Sat, 24 Nov 2018 17:05:23 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9983F82F7B; Sat, 24 Nov 2018 17:05:22 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wAOH5KJe088485; Sat, 24 Nov 2018 09:05:20 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wAOH5K8j088484; Sat, 24 Nov 2018 09:05:20 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201811241705.wAOH5K8j088484@pdx.rh.CN85.dnsmgr.net> Subject: Re: TRIM utility In-Reply-To: To: Dimitry Andric Date: Sat, 24 Nov 2018 09:05:20 -0800 (PST) CC: Wojciech Puchar , Warner Losh , FreeBSD Hackers , Poul-Henning Kamp , Lev Serebryakov , Eugene Grosbein X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 9983F82F7B X-Spamd-Result: default: False [0.47 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.08)[-0.078,0]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.02)[0.019,0]; NEURAL_HAM_LONG(-0.34)[-0.341,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: pdx.rh.CN85.dnsmgr.net]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(-0.02)[country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2018 17:05:23 -0000 > On 24 Nov 2018, at 15:44, Wojciech Puchar wrote: > > > >> Yes. It would. That's hard with the current storage stack to do via the > >> disk interface. And often the underlying protocols do not support partial > >> ranges. There is no good way to do this with buf/bio interface we have. So > > > > what is an actual difference between "secure erase" and trimming whole disk? I wonder if any drive recognises a single trim command that covers the whole drive, or if that is even possible to do. Or if it recognizes that all blocks are infact in a free/trimmed state (should be easy if they have a total block inuse counter, just watch for it to hit 0). > It depends a lot on the device. Some devices encrypt all blocks > automatically, and a Secure Erase command might just throw away the key, > not go over all the data and actively wipe it. > > Most SSDs will likely also trim all the blocks to be erased, since users > have come to expect the SSD performance to go back to the 'out of box' > level, after such an operation. I do not think they actually "trim" anything, I am pretty sure they just do a full FDT re-initializse and keep the block use counters for future allocations, in effect this looks like you trimmed the whole drive but usually completed in just a fex seconds or less. Some manufactures actually recommend this procedure to revive a drives performance that has degraded over time. > > If you are lucky, the manufacturer's documentation will explain the > specifics, but don't count on it. :) And there is that problem :-( -- Rod Grimes rgrimes@freebsd.org