Testing ZFS snapshot database restore for mastodon.nl
Posted on za 15 juni 2024 in mastodonnl
A couple of weeks ago I started pushing ZFS snapshots of the live database partition for mastodon.nl to my homelab. Testing that this is actually usable as a restore point for a postgres database was still on my todo list.
Today I found the time to setup an postgres VM with ZFS support in my homelab too. Then I pushed the latest snapshop from my backup unit to this VM (200 GB in size).
Apart from the ownership and permission issues, the data all seems OK. To make sure there were enough resources, I assigned the VM 4 cores and 16 GB RAM. A couple of moments later I was logged into the psql cli on the mastodon_production database and succesfully querying the accounts table.
So test succeeded, I can stop pushing full database dumps ofsite every day.
The full database dump used to be pushed offsite once a day at about 110 GB of size. The ZFS snapshots are created three times a day and don't need a postgres database dump as it is just the live database directory of the server. This takes about 5 GB of data per snapshot, totalling about 15 GB per day.
So we get more offsite recovery points for less data transfer and less load on the database server. Nice!