tkrn's blog

random thoughts at best

Menu
  • GitHub repo
  • The Hardware
  • tkrn’s archive
  • OpenPGP Key
  • stack overflow
Menu

Set child encrypted ZFS datasets to inherit the parent – Scripted Fix!

Posted on August 10, 2023January 29, 2024 by tkrn

After replicating ZFS snapshots on two TrueNAS platforms, the destination dataset inherits the source dataset encryption properties resulting unlocking that dataset on the destination with the original decryption key. In my scenario, my source and destination datasets have different encryption keys. My desired outcome is to unlock all child datasets with the parent dataset with a single encryption key.

You can set each childset in the GUI manually but that is too time-consuming on a regular basis. Instead, I created a zsh snippet to set child datasets to inherit the parent’s encryption properties.

Please edit the below script to reflect your dataset name. ie replace “tank/backups”

while IFS= read -r line; do
    echo "Setting ZFS Encrpytion inheritance on -> $line"
	sudo zfs change-key -i $line
done <  <(sudo zfs list -r -H -t filesystem -o name,encryptionroot tank/backups | awk '{print $1}')

sudo zfs list -r -t filesystem -o name,encryptionroot tank/backups

Related

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Nextcloud Virtual File System VFS on Ubuntu 24.10, 24.04, 22.04
  • Site-to-Site OpenVPN between OPNsense and Ubiquiti EdgeRouter EdgeOS
  • Debrand a Dell EMC VxRail Node to a PowerEdge Server
  • HPE ssacli on TrueNAS SCALE
  • Set child encrypted ZFS datasets to inherit the parent – Scripted Fix!

Categories

  • Arcade
  • Development
  • FreeNAS/ZFS
  • Sysadmin
  • Tinkering
  • Uncategorized
©2025 tkrn's blog | Theme by SuperbThemes