FreeBSD 12.2-RELEASE-p9 trim (ZFS, not OpenZFS): open failed: /dev/ada0: Operation not permitted

David Christensen dpchrist at holgerdanske.com
Tue Aug 31 01:06:28 UTC 2021


On 8/30/21 2:16 AM, Graham Perrin wrote:
> On 30/08/2021 08:45, David Christensen wrote:
> 
>> … created with FreeBSD-12.1-RELEASE-amd64-memstick on a USB flash 
>> drive with ZFS boot, encrypted swap, and encrypted ZFS root.
>>
>>
>>> If so: with or without OpenZFS kernel module?
>>
>>
>> ZFS kernel module is loaded:
>>
>> 2021-08-30 00:30:42 toor at f3 ~
>> # kldstat
>> Id Refs Address                Size Name
>>  1   23 0xffffffff80200000  227ae98 kernel
>>  2    1 0xffffffff8247c000    1e7b0 geom_eli.ko
>>  3    2 0xffffffff8249b000     a448 opensolaris.ko
>>  4    1 0xffffffff824a8000     ee98 aesni.ko
>>  5    1 0xffffffff824b7000   3bad38 zfs.ko
>>  6    1 0xffffffff82872000    27c00 geom_mirror.ko
>>  7    1 0xffffffff8289a000    27ce8 fuse.ko
>>  8    1 0xffffffff82b21000      acf mac_ntpd.ko
>>
>>> 
> 
> Thanks. Simply installing sysutils/openzfs will get you a relevant 
> manual page:
> 
> man 8 zpool-trim
> 
> – and `zpool trim` (alone) will run (tested in VirtualBox), however: 
> _without_ an OpenZFS-enabled boot, I'd be wary of specifying a pool to 
> be trimmed. Here be dragons?


Thank you for the response.  :-)


I installed the package "openzfs":

2021-08-30 17:54:40 toor at f2 ~
# pkg install -y openzfs
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	openzfs: 2021062100
	openzfs-kmod: 2021062100

Number of packages to be installed: 2

The process will require 22 MiB more space.
4 MiB to be downloaded.
[1/2] Fetching openzfs-2021062100.txz: 100%    3 MiB 365.1kB/s    00:08
[2/2] Fetching openzfs-kmod-2021062100.txz: 100%    1 MiB   1.2MB/s 
00:01
Checking integrity... done (0 conflicting)
[1/2] Installing openzfs-kmod-2021062100...
[1/2] Extracting openzfs-kmod-2021062100: 100%
[2/2] Installing openzfs-2021062100...
[2/2] Extracting openzfs-2021062100: 100%


The man page is there:

2021-08-30 18:00:33 toor at f2 ~
# man zpool-trim | head -n 7
ZPOOL-TRIM(8)           FreeBSD System Manager's Manual 
ZPOOL-TRIM(8)

NAME
      zpool-trim - initiate TRIM of free space in ZFS storage pool

SYNOPSIS
      zpool trim [-dw] [-r rate] [-c|-s] pool [device]<?>


When I try to trim a pool that is on an SSD:

2021-08-30 18:01:18 toor at f2 ~
# zpool trim bootpool 2>&1 | head -n 1
unrecognized command 'trim'


When I try to load the kernel module:

2021-08-30 18:01:22 toor at f2 ~
# kldload openzfs
kldload: an error occurred while loading module openzfs. Please check 
dmesg(8) for more details.

2021-08-30 18:02:10 toor at f2 ~
# dmesg | tail -n 2
interface zfsctrl.1 already present in the KLD 'zfs.ko'!
linker_load_file: /boot/modules/openzfs.ko - unsupported file type


zpool-trim(8) mentions an "autotrim" property, but my pool does not seem 
to have it:

2021-08-30 18:03:14 toor at f2 ~
# zpool get all bootpool | grep -i trim


Suggestions?


David


More information about the freebsd-questions mailing list