LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

zfs

Manage ZFS filesystems and snapshots

TLDR

List all datasets
$ zfs list
copy
Create a new filesystem
$ sudo zfs create [pool/dataset]
copy
Create a snapshot
$ sudo zfs snapshot [pool/dataset@snapshot_name]
copy
List snapshots
$ zfs list -t snapshot
copy
Rollback to snapshot
$ sudo zfs rollback [pool/dataset@snapshot_name]
copy
Set a property
$ sudo zfs set [compression=lz4] [pool/dataset]
copy
Get property value
$ zfs get [compression] [pool/dataset]
copy
Destroy a dataset
$ sudo zfs destroy [pool/dataset]
copy

SYNOPSIS

zfs command [options] [arguments]

DESCRIPTION

zfs manages ZFS filesystems, snapshots, clones, and volumes. ZFS is a combined filesystem and volume manager with advanced features like copy-on-write, snapshots, checksums, and built-in compression.Key concepts:- Datasets are filesystems or volumes within a pool- Snapshots are read-only point-in-time copies- Clones are writable copies created from snapshots- Properties control behavior (compression, quota, mountpoint)ZFS uses hierarchical datasets: pool/parent/child inherits properties from parent. Properties can be set locally to override inheritance.Common properties include compression, quota, reservation, recordsize, atime, and mountpoint.

SUBCOMMANDS

list [-t type] [-o properties] [dataset]

List datasets and properties
create [-p] dataset
Create filesystem or volume (-p creates parents)
destroy [-r] dataset
Destroy dataset (-r recursive)
snapshot dataset@name
Create snapshot
rollback dataset@snapshot
Rollback to snapshot
clone snapshot dataset
Create clone from snapshot
send snapshot
Generate stream for replication
receive dataset
Receive stream into dataset
set property=value dataset
Set property
get property dataset
Get property value
mount dataset
Mount filesystem
unmount dataset
Unmount filesystem

INSTALL

sudo apt install zfs-fuse
copy
sudo apk add zfs
copy
nix profile install nixpkgs#zfs
copy

CAVEATS

Most operations require root privileges.zfs destroy is irreversible. Snapshots protect against accidental deletion but must be created proactively.ZFS can consume significant memory for caching (ARC). Tune zfs_arc_max on memory-constrained systems.Snapshots are cheap but not free. Many snapshots with high data churn can consume significant space.

SEE ALSO

zpool(8), zdb(8), zfs-send(8), zfs-receive(8)

Copied to clipboard
Kai