#zfs #freebsd #os #zol #open3

libzetta

libzetta is a stable interface for programmatic administration of ZFS

9 releases

0.3.1 Apr 17, 2022
0.3.0 Apr 16, 2022
0.2.3 Oct 25, 2021
0.2.2 Apr 26, 2020
0.1.2 Aug 12, 2019

#69 in Operating systems

Download history 7/week @ 2022-01-25 5/week @ 2022-02-01 4/week @ 2022-02-08 6/week @ 2022-02-15 12/week @ 2022-02-22 4/week @ 2022-03-01 8/week @ 2022-03-08 25/week @ 2022-03-15 46/week @ 2022-03-22 5/week @ 2022-03-29 11/week @ 2022-04-05 35/week @ 2022-04-12 23/week @ 2022-04-19 65/week @ 2022-04-26 43/week @ 2022-05-03 144/week @ 2022-05-10

285 downloads per month

BSD-2-Clause

255KB
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

Installation

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.

Usage

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.

FreeBSD

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

Linux

Right now it verified works with 0.7.13 and entire 0.7.x branch.

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

Note that integration tests do a lot of zpool and zfs operations on live system. I recommend spin up a VM and use run_tests.sh to run integration tests inside. Tests also take a lot of disk space because each vdev is at least 64mb file.

Current feature status

zpool

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.

zfs

Filesystem and ZVOL

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

Snapshot and bookmark

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

Alternatives

https://github.com/whamcloud/rust-libzfs

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

https://github.com/jmesmon/rust-libzfs

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

LICENSE

BSD-2-Clause.

Dependencies

~4–5.5MB
~119K SLoC