ROOT.Zfs.Public 1.1.10

dotnet add package ROOT.Zfs.Public --version 1.1.10                
NuGet\Install-Package ROOT.Zfs.Public -Version 1.1.10                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ROOT.Zfs.Public" Version="1.1.10" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ROOT.Zfs.Public --version 1.1.10                
#r "nuget: ROOT.Zfs.Public, 1.1.10"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ROOT.Zfs.Public as a Cake Addin
#addin nuget:?package=ROOT.Zfs.Public&version=1.1.10

// Install ROOT.Zfs.Public as a Cake Tool
#tool nuget:?package=ROOT.Zfs.Public&version=1.1.10                

Introduction

ZFS .NET library which interfaces with the zfs/zpool binaries to manipulate and query the ZFS file system.

.NET CI Build .NET Integration Lines of Code Quality Gate Status Bugs Vulnerabilities Duplicated Lines (%) Coverage

Tested against ZoL

  • version 2.1.5-2 on Rocky Linux 8.5
  • version 2.1.4 on Ubuntu 22.04
  • version 0.86 on Ubuntu 20.04

Will most likely work against different versions, but some of the commands will fail against ZFS on different platforms, since the supporting commands used to load disk/partition information are different - or because the commands are simply not available in that version of zfs.

Commands that do not exist in the version of zfs you are running against, will obviously also fail.

This is something that could be fixed in future versions.

Example


// First decide if you are connecting to localhost or another machine
// null indicates that you are running on the same machine where the zfs pool is located
// Otherwise you would do: new SSHProcessCall("username","hostname",true);
SSHProcessCall connection = null;

// Create instance of zfs class
var zfs = new Core.Zfs(null);

// Get status of the pool tank
var status = zfs.Pool.GetStatus("tank");

if (status.State == State.Online)
{
    return;
}

var pool = status.Pool;
foreach (var vdev in pool.VDevs)
{
    if (vdev.State == State.Online)
    {
        continue;
    }

    Console.WriteLine("vdev:{0}, State:{1}", vdev.Name, vdev.State);
    foreach (var device in vdev.Devices)
    {
        if (device.State == State.Online)
        {
            continue;
        }

        Console.WriteLine("Device:{0}, State:{1}", device.DeviceName, device.State);
    }
}

More examples on the wiki

Dependencies

Obviously this software requires ZFS to be installed on the target server. Besides ZFS - some methods also invokes the following binaries:

smartctl, lsblk, ls

smartctl is usually found in the package called smartmontools the two others should be available in the base installation of the OS.

Help needed

If you want to help make this library greater either by

  • Contributing code
  • Writing examples
  • Better documentation
  • Writing tests and writing expected responses for a given version of zfs - if it differs from version to version
  • In any other way, feel free to contact @bjornbouetsmith.

NOTE

Nuget packages found here on github is to be considered development versions and is only meant to enable ci/cd within the ROOT projects.

Packages not found on nuget.org should not be used in production code unless you are ready to change stuff if interfaces or something changes.

Its fine to take packages from here to test out patches etc, but do not expect stable interfaces on new features until its released on nuget.org.

Documentation

Documentation is based on the openzfs documentation with license. If you believe I am in breach of the license, please get in touch.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ROOT.Zfs.Public:

Package Downloads
ROOT.Zfs.Core

Linux ZFS classes to interact with ZFS pools/datasets

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.10 152 6/8/2024
1.1.9 121 6/8/2024
1.1.8 111 6/8/2024
1.1.7 229 12/10/2023