Date: Fri, 3 Sep 2021 18:54:48 -0700 From: David Christensen <dpchrist@holgerdanske.com> To: freebsd-questions@freebsd.org Subject: Re: FreeBSD 12.2-RELEASE-p9 trim: open failed: /dev/ada0: Operation not permitted Message-ID: <3cefb7d0-6a6e-8cb5-f730-d4c7fc6dbb4e@holgerdanske.com> In-Reply-To: <4019d92e-c33d-6ba1-dc80-7e28ccc44802@panix.com> References: <dda0a570-53bc-7676-9f38-67bcd7a6f8bb@holgerdanske.com> <47d0f250-a47c-bbe0-2875-4f42f4464fcc@chezmarcotte.ca> <64099455-5526-beb5-8ead-6ce8a9d073e6@holgerdanske.com> <4019d92e-c33d-6ba1-dc80-7e28ccc44802@panix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 9/3/21 1:49 PM, Kurt Hackenberg wrote: > 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? My goal is to invoke a userspace utility that trims the unused blocks of the SSD prior to taking a raw binary image. On Linux, it is pronounced fstrim(8): https://man.archlinux.org/man/fstrim.8 > 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 so, I am lucky that trim(8) did not work (!). > If you're using ZFS, perhaps you should look for a way to configure the > ZFS filesystem to erase on free. A reply from another reader indicates OpenZFS on FreBSD 14 supports both automatic trim and userspace trim on command. David
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3cefb7d0-6a6e-8cb5-f730-d4c7fc6dbb4e>