In order to simplify mounting and unmounting my encrypted volumes, I wanted some scripts.
Recursively Mount
#!/usr/bin/env sh
dataset=$1
zfs load-key "${dataset}"
zfs list -rH -o name "${dataset}" | xargs -L 1 zfs mount
Unmount and unload key
#!/usr/bin/env sh
dataset=$1
zfs unmount "${dataset}"
zfs unload-key "${dataset}"
Usage
# mount example
sh mount.sh storage/encrypted
Passphrase:
Passphrase:
# unmount example
sh unmount.sh storage/encrypted
sh unmount.sh storage/encrypted
Appendix
Sources
No comments:
Post a Comment