From owner-freebsd-questions@freebsd.org Fri Sep 3 20:49:11 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDA4267D6C0 for ; Fri, 3 Sep 2021 20:49:11 +0000 (UTC) (envelope-from kh@panix.com) Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H1VJk4HSbz3mZY for ; Fri, 3 Sep 2021 20:49:10 +0000 (UTC) (envelope-from kh@panix.com) Received: from rain.home (pool-96-230-243-2.bstnma.fios.verizon.net [96.230.243.2]) by mailbackend.panix.com (Postfix) with ESMTPSA id 4H1VJc5P0SzSwg for ; Fri, 3 Sep 2021 16:49:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=panix.com; s=panix; t=1630702144; bh=HY081WSLPl3ujP0uk3us8BFFni2Co1FXyS47DhWqgVI=; h=Subject:To:References:From:Date:In-Reply-To; b=G18hd3Hh0ogwuSqet0MgkBJidGBJ++yhReCAGISF0gTfcp3sHpAADpjSjrNpTBFhx Raw5i1jMdrwSDGavJkMjcCpIZKFBKtC0hQ0/xZ0clYu7IwyFAtzFaQamcrMQ4G+dtN sWS3jJVblIIzPMYN5euiTd8eqC35UTpWWS4Nn/gk= Subject: Re: FreeBSD 12.2-RELEASE-p9 trim: open failed: /dev/ada0: Operation not permitted To: freebsd-questions@freebsd.org References: <47d0f250-a47c-bbe0-2875-4f42f4464fcc@chezmarcotte.ca> <64099455-5526-beb5-8ead-6ce8a9d073e6@holgerdanske.com> From: Kurt Hackenberg Message-ID: <4019d92e-c33d-6ba1-dc80-7e28ccc44802@panix.com> Date: Fri, 3 Sep 2021 16:49:02 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <64099455-5526-beb5-8ead-6ce8a9d073e6@holgerdanske.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4H1VJk4HSbz3mZY X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=panix.com header.s=panix header.b=G18hd3Hh; dmarc=none; spf=pass (mx1.freebsd.org: domain of kh@panix.com designates 166.84.1.89 as permitted sender) smtp.mailfrom=kh@panix.com X-Spamd-Result: default: False [-2.15 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[166.84.1.89:from]; R_SPF_ALLOW(-0.20)[+ip4:166.84.0.0/16]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[panix.com:+]; RECEIVED_SPAMHAUS_PBL(0.00)[96.230.243.2:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:2033, ipnet:166.84.0.0/16, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[panix.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[panix.com:s=panix]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[panix.com]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_SHORT(0.35)[0.354]; RCVD_IN_DNSWL_NONE(0.00)[166.84.1.89:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2021 20:49:11 -0000 On 2021/09/03 16:30, David Christensen wrote: >> It might be that a raw device could be trimmed, but perhaps there's >> some safety there to stop it from wiping a device that is backing a >> mounted filesystem. ... > That is a good point -- the filesystem knows what blocks are in use, > what blocks are not in use, and when blocks are removed from use. > Somehow, trim(8) gets this information (from the kernel filesystem stack?). > > > RTFM trim(8): Do I understand correctly that you want to set a state, so that the filesystem, ongoing, erases a block when it frees the block? According to that man page, the trim command does something different: it erases blocks immediately, unconditionally, regardless of whether they're in use. The man page says: "The trim utility erases specified region of the device." "The whole device is erased by default..." If you're using ZFS, perhaps you should look for a way to configure the ZFS filesystem to erase on free.