I would like to have more granular database backups for my apps. So if something breaks or goes wrong, I will have enough database copies to restore all the data I need.
At least I want an everyday copy or often. But I also don't want to store a lot of old backup files. If something breaks, I will probably notice that within one week or two. So I need more granular, everyday backups for two weeks. And then I am fine with one backup per week (for 8 last weeks) and one or two backups per month.
This is called the Grandfather-Father-Son (GFS) backup rotation scheme. It organizes copies into three main tiers — daily, weekly, and monthly — to balance recent recovery points with long-term archiving while keeping storage costs manageable.
To achieve GFS backup rotation, we can use the backroll command-line utility.
bunx backroll --clean db.dump ./backup
Enter fullscreen mode
Exit fullscreen mode
It will copy the db.dump into the ./backups folder. The --clean option will remove the original db.dump file.…