Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an API to access the ZFS filesystem

Tags:

freebsd

zfs

I would like to know if there is a way to access the ZFS api (preferably from python but C is fine too). My goal is to write some tools that will monitor my pools but would definitely like to not to have to parse output of zpool command.

like image 319
Dave Avatar asked Dec 28 '11 01:12

Dave


2 Answers

There are java bindings to the libzfs on Solaris. AFAIK they haven't been ported (yet) to BSD or Linux. However, it might not be too big of an endeavour to start that, since it is Java after all, it could be relatively portable already.

IIRC the Java API was used for Solaris 10's ZFS Management Web Interface.

Also, I've heard rumors about a Python API (perhaps it was used in the new-style Autosnapshot service by Tim Foster?).

Here is a link to the latest bits I knew how to find

  • http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libzfs_jni/
  • http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/pyzfs/
like image 118
sehe Avatar answered Sep 23 '22 08:09

sehe


Additionally if you are using OpenZFS (ie. ZFS on Illumos, FreeBSD, Linux, Mac OS X, etc.) there is now libzfs_core as alternative to libzfs (which was iirc never a stable API). See: http://blog.delphix.com/matt/2012/01/17/the-future-of-libzfs/

like image 40
Jasper Siepkes Avatar answered Sep 25 '22 08:09

Jasper Siepkes