TrueNAS Useful commands

TrueNAS Useful commands
Photo by Jainath Ponnala / Unsplash

Create a Recursive Snapshot This command takes a snapshot of a dataset and all its children, capturing a point-in-time copy for backup purposes.

sudo zfs snapshot -r Dataset_1/ChildDataset_1@initialbackup

  • -r: Recursively snapshots the dataset and its children.
  • Dataset_1/ChildDataset_1: The source dataset path.
  • @initialbackup: The snapshot name.

Replicate the Snapshot to Another Dataset This command sends the snapshot to another dataset, optionally monitoring the transfer speed with pv (pipe viewer).

sudo zfs send -R Dataset_1/ChildDataset_1@initialbackup | pv | sudo zfs receive Dataset_2/ChildDataset_1

  • -R: Sends the snapshot recursively, including all child datasets and properties.
  • pv: Displays the transfer progress (optional, install with sudo apt install pv on Debian-based systems).
  • Dataset_2/ChildDataset_1: The destination dataset path.

List all snapshots of a given dataset:

zfs list -t snapshot -r poolname/dataset

Assign the correct acltype after a copy without -R

sudo zfs set acltype=nfsv4 poolname/dataset

Copy only the permissions if the data is matching in both sides:

sudo rsync -aAX --acls --perms --owner --group /mnt/sourcepoolname/dataset/ /mnt/poolname/dataset/

Check current disks speed while transfering

sudo zpool iostat -v 1