
Security News
CISA Rebuffs Funding Concerns as CVE Foundation Draws Criticism
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
__ ___
/\ \ /'___\
___ ___ \_\ \ __ ____ /\ \__/ ____
/' _ `\ / __`\ /'_` \ /'__`\ _______/\_ ,`\\ \ ,__\/',__\
/\ \/\ \/\ \L\ \/\ \L\ \/\ __//\______\/_/ /_\ \ \_/\__, `\
\ \_\ \_\ \____/\ \___,_\ \____\/______/ /\____\\ \_\\/\____/
\/_/\/_/\/___/ \/__,_ /\/____/ \/____/ \/_/ \/___/
node-zfs is a simple wrapper around the zfs
and zpool
commands. It enables
ZFS management scripting using Node.js under SmartOS, Solaris, OpenIndiana and
FreeBSD. Node-zfs is also tested successfully on Ubuntu.
Using npm:
$ npm install --save zfs
var zfs-filesystem = require('zfs');
##Now you can address the zfs library as follows:
zfs-filesystem.zfs.
###To use the zpool implementation:
zfs-filesystem.zpool.
###ZFS list
The list command lists a specific zfs dataset or all datasets. All possible options can be found inside the lib/zfs.js file.
zfs-filesystem.zfs.list(function (err, list) {
console.log(list)
});
###ZFS get
Get the parameters of a specific dataset or all datasets. All possible options can be found inside the lib/zfs.js file.
var opts = {
name: 'my-dataset-name',
property: 'quota'
};
zfs-filesystem.zfs.get(opts, function (err, options) {
console.log(options);
});
###ZFS set
Set a specific option for a given dataset. All possible options can be found inside the lib/zfs.js file.
var opts = {
name: 'my-dataset-name',
property: 'quota',
value: '1024G'
};
zfs-filesystem.zfs.set(opts, function (err, output) {
console.log(output);
});
###ZFS Destroy
Remove a dataset from the ZFS filesystem
var opts = {
name: 'my-dataset-name'
};
zfs-filesystem.zfs.destroy(opts, function (err, output) {
console.log(output);
});
###ZFS Create
Create a new dataset inside the ZFS filesystem. All possible options can be found inside the lib/zfs.js file.
var opts = {
name: 'my-new-dataset-name'
};
zfs-filesystem.zfs.create(opts, function (err, output) {
console.log(output);
});
###ZFS Snapshot
Creates a snapshot with the given name. All possible options can be found inside the lib/zfs.js file.
var opts = {
name: 'my-new-snapshot-name',
dataset: 'my-dataset-name'
};
zfs-filesystem.zfs.snapshot(opts, function (err, output) {
console.log(output);
});
###ZFS Clone
Creates a clone of the given snapshot. All possible options can be found inside the lib/zfs.js file.
var opts = {
snapshot: 'my-snapshot-name',
dataset: 'my-mountpoint-name'
};
zfs-filesystem.zfs.clone(opts, function (err, output) {
console.log(output);
});
Mount the filesystem with the specified name or all filesystems. All possible options can be found inside the lib/zfs.js file.
var opts = {
dataset: 'my-filesystem-name'
};
zfs-filesystem.zfs.mount(opts, function (err, output) {
console.log(output);
});
Unmount the filesystem or the mountpoint or all filesystems. All possible options can be found inside the lib/zfs.js file.
var opts = {
name: 'my-filesystem-name',
force: true
};
zfs-filesystem.zfs.unmount(opts, function (err, output) {
console.log(output);
});
Initiates a send of a given snapshot and returns a readable stream. All possible options can be found inside the lib/zfs.js file.
var opts = {
snapshot : '/pool/dataset@snapshot',
verbose : true
};
zfs-filesystem.zfs.send(opts, function (err, sendStream) {
sendStream.on('error', function (err) {
console.error(err);
});
sendStream.on('verbose', function (data) {
console.log(data);
});
sendStream.pipe(process.stdout).on('end', function () {
console.log('done');
});
});
Initiates a receive and returns a writable stream to which a send stream may be written. All possible options can be found inside the lib/zfs.js file.
var opts = {
dataset : '/pool2/dataset',
verbose : true
};
zfs-filesystem.zfs.receive(opts, function (err, receiveStream) {
receiveStream.on('error', function (err) {
console.error(err);
});
receiveStream.on('verbose', function (data) {
console.log(data);
});
process.stdin.pipe(receiveStream).on('end', function () {
console.log('done');
});
});
###ZPool Create
Creates a new storage pool containing the virtual devices specified. All possible options can be found inside the lib/zpool.js file.
var opts = {
name: 'my-datastore',
devices: ['/dev/vdb', '/dev/vdc']
};
zfs-filesystem.zpool.create(opts, function (err, output) {
console.log(output);
});
###ZPool Add
Adds the specified virtual devices to the given pool. All possible options can be found inside the lib/zpool.js file.
var opts = {
name: 'my-datastore',
devices: '/dev/vdd'
};
zfs-filesystem.zpool.add(opts, function (err, output) {
console.log(output);
});
###ZPool Set
Sets the given property on the specified pool. See the zpool manpage for possible options and values.
var opts = {
name: 'my-datastore',
property: 'comment',
value: 'Added some comment to a datastore'
};
zfs-filesystem.zpool.set(opts, function (err, output) {
console.log(output);
});
###ZPool Destroy
Destroys the given pool, freeing up any devices for other use.
var opts = {
name: 'my-datastore',
};
zfs-filesystem.zpool.destroy(opts, function (err, output) {
console.log(output);
});
###ZPool List
Lists the given pools along with a health status and space usage. If no pools are specified, all pools in the system are listed.
zfs-filesystem.zpool.list(function (err, output) {
console.log(output);
});
###ZPool Get
Retrieves the given list of properties. When no name and property specified, it shows all properties for all datastores. See the zpool manpage for possible options and values.
zfs-filesystem.zpool.get(function (err, output) {
console.log(output);
});
MIT
FAQs
A Node.js wrapper around zfs/zpool
The npm package zfs receives a total of 236 weekly downloads. As such, zfs popularity was classified as not popular.
We found that zfs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.