Nice. Let me know if you need any help with that. Restore could be a bit difficult to not mess up access rights. Not sure Tor would auto fix wrong access rights, probably not.
What’s easier? Copy Tor state folder to a temporary folder and copy back?
Or involving git…
Install git.
sudo apt-get update
sudo apt-get install git
Backup.
sudo su
systemctl stop tor@default
cd /var/lib/tor
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git add *
git commit -a -m .
Delete.
sudo rm -r /var/lib/tor/*
Let Tor generate new state files.
systemctl restart tor@default
Restore.
sudo su
systemctl stop tor@default
cd /var/lib/tor
git reset --hard
systemctl restart tor@default
Lightly tested.