bsdkrun/zfs

ZFS volumes: one zpool per volume on a disk image, held by one machine at a time (Linux, FreeBSD, NetBSD). Branches are datasets cloned copy-on-write inside the pool (zfs snapshot + zfs clone), so a branch costs nothing until it diverges.

Values

pub fn attach(
  target: String,
  machine: String,
  mount: option.Option(String),
) -> Result(String, error.Error)

Attach VOL or VOL@BRANCH to a machine at mount (/mnt/VOL, or /mnt/VOL-BRANCH, when None). A pool is imported by one machine at a time; a stopped machine picks it up on start, a running holder mounts the branch live. Returns the CLI’s one-line report.

pub fn branch(
  volume: String,
  name: String,
  from: option.Option(String),
) -> Result(String, error.Error)

Fork a branch copy-on-write from from (main when None). Runs in the machine holding the volume or in a short-lived FreeBSD helper, so it can take as long as a BSD boot. Returns the new VOL@BRANCH.

pub fn branches(
  volume: String,
) -> Result(List(types.ZfsBranch), error.Error)

The branches of one volume.

pub fn create(
  name: String,
  size: option.Option(String),
) -> Result(String, error.Error)

Create a volume: a sparse image that becomes a zpool with a main branch the first time a guest imports it. size like "10G" (the default).

pub fn destroy(
  targets: List(String),
  force: Bool,
) -> Result(Nil, error.Error)

Destroy branches (VOL@BRANCH) or whole volumes (VOL). force destroys a volume a stopped machine still has attached.

pub fn detach(
  target: String,
  machine: String,
) -> Result(String, error.Error)

Detach one branch (VOL@BRANCH) or the whole volume (VOL) from a machine.

pub fn list() -> Result(List(types.ZfsVolumeInfo), error.Error)

List ZFS volumes, with their branches and holder.

✨ Search Document