List dataset sorted by property

zfs list -H -o name,creation -s creation

Unmount

zfs list -rH -o name tank/backups/foobar | xargs -L 1 zfs unmount

Destroy

zfs list -H -o name -t snapshot | xargs -n1 zfs destroy

''xz'' instead of ''gzip'' for zfs stream compression, e.g. for 24 cores

zfs send | xz -T 24 | unxz | zfs recv

Zpool I/O

zpool iostat -v 1

Set Property for Multiple Dataset

zfs list -o name | grep ^poolname | xargs -n1 zfs set canmount=noauto

ZFS Resume

Use zfs receive -s to save the partially received state on failure. On failure, get the receive token with zfs get receive_resume_token <fs> Resume the send with zfs send -t <token_value>.

ZFS Backup

# /etc/crontab
# * * * * * root /usr/local/bin/flock -xn /var/run/zxfer-sync.flock -c /usr/local/scripts/zxfer-sync
/usr/local/sbin/zxfer -u -v -k -F -d -R tank -I atime,mounted,jailed,sharenfs,sharesmb,mountpoint,quota,refquota,reservation,refreservation,compression,dedup,,org.freebsd.iocage:sync_tgt_zpool,org.freebsd.iocage:pseudoterminals,org.freebsd.iocage:vmemoryuse,org.freebsd.iocage:securelevel,org.freebsd.iocage:nmsgq,org.freebsd.iocage:exec_start,org.freebsd.iocage:mount_procfs,org.freebsd.iocage:vnet4_mac,org.freebsd.iocage:ip6_saddrsel,org.freebsd.iocage:exec_stop,org.freebsd.iocage:sync_target,org.freebsd.iocage:exec_fib,org.freebsd.iocage:memorylocked,org.freebsd.iocage:resolver,org.freebsd.iocage:boot,org.freebsd.iocage:exec_clean,org.freebsd.iocage:vnet2_mac,org.freebsd.iocage:stacksize,org.freebsd.iocage:allow_sysvipc,org.freebsd.iocage:exec_system_user,org.freebsd.iocage:coredumpsize,org.freebsd.iocage:allow_mount_tmpfs,org.freebsd.iocage:template,org.freebsd.iocage:enforce_statfs,org.freebsd.iocage:owner,org.freebsd.iocage:allow_mount,org.freebsd.iocage:ip6,org.freebsd.iocage:allow_chflags,org.freebsd.iocage:pcpu,org.freebsd.iocage:ip4_autosubnet,org.freebsd.iocage:msgqqueued,org.freebsd.iocage:rlimits,org.freebsd.iocage:exec_poststop,org.freebsd.iocage:host_hostuuid,org.freebsd.iocage:last_started,org.freebsd.iocage:ip6_addr,org.freebsd.iocage:datasize,org.freebsd.iocage:vnet,org.freebsd.iocage:children_max,org.freebsd.iocage:exec_prestop,org.freebsd.iocage:allow_mount_devfs,org.freebsd.iocage:swapuse,org.freebsd.iocage:hack88,org.freebsd.iocage:devfs_ruleset,org.freebsd.iocage:nsemop,org.freebsd.iocage:defaultrouter,org.freebsd.iocage:exec_timeout,org.freebsd.iocage:openfiles,org.freebsd.iocage:gitlocation,org.freebsd.iocage:cpuset,org.freebsd.iocage:allow_mount_zfs,org.freebsd.iocage:exec_jail_user,org.freebsd.iocage:cputime,org.freebsd.iocage:vnet1_mac,org.freebsd.iocage:allow_mount_nullfs,org.freebsd.iocage:exec_system_jail_user,org.freebsd.iocage:maxproc,org.freebsd.iocage:host_hostname,org.freebsd.iocage:allow_quotas,org.freebsd.iocage:mount_devfs,org.freebsd.iocage:ip4,org.freebsd.iocage:allow_socket_af,org.freebsd.iocage:jail_zfs_dataset,org.freebsd.iocage:type,org.freebsd.iocage:hostid,org.freebsd.iocage:memoryuse,org.freebsd.iocage:msgqsize,org.freebsd.iocage:ip4_autostart,org.freebsd.iocage:mount_fdescfs,org.freebsd.iocage:ip4_saddrsel,org.freebsd.iocage:ip4_addr,org.freebsd.iocage:defaultrouter6,org.freebsd.iocage:allow_set_hostname,org.freebsd.iocage:release,org.freebsd.iocage:shmsize,org.freebsd.iocage:notes,org.freebsd.iocage:exec_poststart,org.freebsd.iocage:exec_prestart,org.freebsd.iocage:nshm,org.freebsd.iocage:allow_raw_sockets,org.freebsd.iocage:stop_timeout,org.freebsd.iocage:nthr,org.freebsd.iocage:wallclock,org.freebsd.iocage:priority,org.freebsd.iocage:login_flags,org.freebsd.iocage:allow_mount_procfs,org.freebsd.iocage:jail_zfs,org.freebsd.iocage:ip4_autoend,org.freebsd.iocage:vnet0_mac,org.freebsd.iocage:hostname,org.freebsd.iocage:tag,iohyve:cpu,iohyve:size,iohyve:description,iohyve:ram,iohyve:con,iohyve:install,iohyve:tap,iohyve:bargs,iohyve:persist,iohyve:loader,iohyve:name,iohyve:boot,iohyve:os -T root@backup_intra -o readonly=on,atime=off data-02/backup

  • unix/zfs.txt
  • Last modified: 2019-03-18T16:57:21+0100
  • by Wolfgang