User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

Starting with release 0.6.5 of raspiBackup an itelligent rotation strategy of your backups is supported. It's also called GFS (grandfather-father-son backup). The implementation was inspired by Manuel Dewalds article Automating backups on a Raspberry Pi NAS

raspiBackup retains following backups per default if a daily backup is created:

1) Backup of the current day and the last 6 days

2) Backup of the current week and the last 3 weeks

3) Backup of the current month  and the last 11 months

4) Backup of the current year and the last two years

If weekly backups are created there will be no daily backups kept. Different retention values for daily, weekly, monthly and yearly can be defined with an option, e.g. if you want to retain weekly, monthly and yearly backups. Keep in mind the weekly backup day then will become the day of the weekly and monthly backup: If you configure Monday as the weekly backup day your monthly backup will be the first Monday of every month. Yout yearly backup will be the first Monday of the year. Iy you create a weekly backup every Sunday the monthly backup will be the first Sunday of the month and the yearly backup will be the first Sunday of the year.


raspiBackup - Smart recycle backup strategy


If there are multiple daily backups the latest backup will be retained. Weekly, monthy or yearly backups will use the earliest backup of the week, month or year. If there exist two daily backups from 10:00 AM and 11:00 PM the backup from 11 AM will be retained. If there exist daily backups from Monday, and Friday the backup from Monday will be retained. If there exist backups on 1., 10. and 30. of a month the backup from 1. will be retained. if you create daily backups every weekly backup will start Monday, every monthls backup will be the 1. backup of a month and yearly backups will be the backup of the 1. January of the year.




Smart recycle backup strategy example - Backupdirectory (daily backup, Defaultoptions: 7/4/12/3)

(Backup run on 2019/11/19)

20191117 1. daily backup
20191116 2. daily backup
20191115 3. daily backup
20191114 4. daily backup
20191113 5. daily backup
20191112 6. daily backup

20191111 7. daily and 1. weekly backup
20191101 1. monthly backup
20191104 2. weekly backup
20191001 2. monthly backup
20191028 3. weekly backup
20191021 4. weekly backup
20190901 3. monthly backup
20190801 4. monthly backup
20190701 5. monthly backup
20190601 6. monthly backup
20190501 7. monthly backup
20190401 8. monthly backup
20190301 9. monthly backup
20190201 10. monthly backup

20190101 11. monthly backup and 1. yearly backup
20181201 12. monthly backup
20180101 2. yearly backup
20170101 3. yearly backup


Smart recylce backup strategy - Options

You enable the smart recycle backup strategy with option --smartRecycle. Option --smartRecycleOptionscan be used to change the default retention sizes. Default is option--smartRecycleOptions "7 4 12 3". --smartRecycleOptions "0 4 12 0" will retain for example the last 4 weekly and the last 12 montly backups.

Important note: As long as you don't turn offf --smarteRecycleDryrun raspiBackup only writes messages explaining which backups would be deleted and which would be retained. That way you can check whether the result maps to what you expect and will not delete old backups by accident which you want to keep. That's important to check when you already have a backup history and start using the smart recycle backup strategy and don't use a new backup directory. If you are sure the smart recycle backup strategy retains the correct backups disable the dryrun with option --smartRecycleDryrun-and then in every backup run the smart recycle backup strategy will be applied and all backups not needed any more will be deleted. As an alternative you can use config option DEFAULT_SMART_RECYCLE_DRYRUN=0to disable the dry run.


Add comment

*** Note ***

Comments are welcome. But in order to reject spam posts please consider following rules:
  1. Comments with string http are rejected with message You have no rights to use this tag
  2. All comments are reviewed by hand and thus it usually takes one day until a comment will be published.