Created
September 10, 2022 23:20
-
-
Save rkeiii/0fe05fdcee6f520c208280acbf2b49ea to your computer and use it in GitHub Desktop.
Hack fix script for volumes suffering ZFS encryption bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This script attempts to recover a ZFS filesystem afflicted by the bug described in | |
# the following GitHub issues: | |
# | |
# * https://github.com/openzfs/zfs/issues/13859 | |
# * https://github.com/openzfs/zfs/issues/13521 | |
# * https://github.com/openzfs/zfs/issues/13709 | |
# | |
# the ZFS filesystem we need to hack recover | |
fs=$1 | |
# where to store ZFS incremental | |
tmpfile=/tmp/recover_zfs_hack | |
# tmp snapshot names | |
snap1=recover1 | |
snap2=recover2 | |
sudo zfs snapshot $fs@$snap1 | |
sudo zfs snapshot $fs@$snap2 | |
sudo zfs send --raw -i $fs@$snap1 $fs@$snap2 > $tmpfile | |
sudo zfs rollback -r $fs@$snap1 | |
sudo zfs receive -F -v $fs < $tmpfile | |
sudo zfs mount $fs | |
sudo rm $tmpfile | |
echo "Enjoy your (hack) fixed ZFS filesystem! (Fingers crossed)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thanks a lot!