Is there an API to access the ZFS filesystem
Asked Answered
S

3

8

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.

Superscribe answered 28/12, 2011 at 1:49 Comment(0)
G
6

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

Guggle answered 2/1, 2012 at 14:18 Comment(1)
This is quite an old answer now. Have a look at zfsonlinux.org to check whether they have better support nowGuggle
R
3

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/

Reconciliatory answered 31/5, 2014 at 9:36 Comment(0)
B
0

Well, it may not be a full answer but there is the libzfs library in /usr/lib. The strange thing is that headers for libzfs (zfs.h and etc.) aren't installed and only present in kernel sources.

So, if you need to develop something using libzfs, you may try to install kernel sources and include needed headers from there.

Bless answered 2/1, 2012 at 12:21 Comment(1)
yes i have noticed it already. what is even more weird is that if you try to load the shared object you get some errors just at the loading timeSuperscribe

© 2022 - 2024 — McMap. All rights reserved.