Skip to content

Instantly share code, notes, and snippets.

@rudolfbyker
Created August 16, 2024 06:59
Show Gist options
  • Save rudolfbyker/90e60ac8927d91677de6b5f6ca8cc1c8 to your computer and use it in GitHub Desktop.
Save rudolfbyker/90e60ac8927d91677de6b5f6ca8cc1c8 to your computer and use it in GitHub Desktop.
Backup and restore ZFS PVCs on Kubernetes

Backup and restore ZFS PVCs on Kubernetes

Dump all ZFS PVCs to files:

for name in $(zfs list -H -o name | grep pvc); do zfs snapshot $name@snap1; zfs send $name@snap1 | pv | gzip > ${name##*/}.gz; done

Restore a ZFS dataset from a file:

pv ${SRC}.gz | zcat | zfs receive -F zfspv-pool/${DST}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment