#zfs #freebsd #os #open3 #zol


libzetta is a stable interface for programmatic administration of ZFS

13 unstable releases (4 breaking)

0.5.0 May 13, 2023
0.4.3 May 12, 2023
0.4.2 Apr 1, 2023
0.3.1 Apr 17, 2022
0.1.2 Aug 12, 2019

#473 in Filesystem

Download history 4/week @ 2024-01-06 4/week @ 2024-01-13 3/week @ 2024-01-20 1/week @ 2024-01-27 4/week @ 2024-02-10 28/week @ 2024-02-17 24/week @ 2024-02-24 26/week @ 2024-03-02 28/week @ 2024-03-09 11/week @ 2024-03-16 14/week @ 2024-03-23 29/week @ 2024-03-30 12/week @ 2024-04-06 12/week @ 2024-04-13 15/week @ 2024-04-20

74 downloads per month
Used in symo


5.5K SLoC

Build Status codecov Crates.io Cirrus CI - Base Branch Build Status docs.rs license

libzetta-rs is a stable interface for programmatic administration of ZFS


Not yet. It won't break your pool or kill your brother, but API might change. Wait until 1.0.0. I have a pretty decent roadmap to 1.0.0.


Public API for zpool stable. Public API for zfs might change after I actually get to use it in other projects. Consult the documention on usage.


This library focused on FreeBSD support. This should work on any FreeBSD version since 9.2. No intention on supporting legacy versions. Supported versions:

  • 12.1
  • 13.0 (No CI setup for it)

NOTE: FreeBSD 13.0 borked libzfs_core dependencies. Until it's fixed solution is to use LD_PRELOAD to load libzfs_core from ports. NOTE: Since FreeBSD switched to OpenZFS, support for "legacy" will be dropped at first breakage.


Verified on what is avaiable for Ubuntu 20.04 at the time of writting it's 0.8.3.

How it works

ZFS doesn't have stable API at all.libzfs_core(lzc) fills some gaps, but not entirely. While lzc provides stable APi to some features of zfs, there is no such thing for zpool. This library resorts to zfs(8) and zpool(8) where lzc falls shorts.

Running tests

Vagrantfile has 3 VMS: ubuntu-20.04, FreeBSD 12 and FreeBSD 13 to use them:

  • Spin up either one of those
  • Install just
  • Run just test-ubuntu or just test-freebsd12 to run tests in the VM
  • To run a specific test run just test-ubuntu "-- easy_snapshot_and_bookmark"

NOTE: Integration tests must be run as a root. Zpools and datasets will be created/modified/destroyed. If it wipes your system datasets that's on you for running it outside of VM.


Project is nix-flake enabled, but it flake itself isn't enough: you need to provide libzfs_core and its dependencies yourself. This is on-purpose.

Current feature status


Create Destroy Get Properties Set Properties Scrub Export Import List Available Read Status Add vdev Replace Disk
open3 ✔¹
  1. Reads the status, but api isn't stable and does poor job at reporting scrubbing status.


Filesystem and ZVOL

Create Destroy List Get Properties Update Properties
lzc ✔¹
  1. Might not have all properties available.

Snapshot and bookmark

Create Destroy List Get Properties Send Recv
lzc ✔¹
  1. Might not have all properties available.



Unlike them LibZetta doesn't link against private libraries of ZFS. libzetta also has more documention.


LibZetta has zpool APIs. LibZetta shares -sys crates with this library. LibZetta also will delegate certain features of zfs(8) to open3 implementation.




~187K SLoC