Why don’t we have it? Even just some simple script that could be activated up backup to ‘x’ drive/USB on ‘y’ date and time. Not everyone would use it (people who need 24/7 usage and who only choose when very carefully to shut all services down for a backup) but I know many of us would still use it. I certainly would.
ghettopi I had found this script which seemed to be nice but to me it does not work (taken from https://dietpi.com/forum/t/automate-dietpi-backup/2271/1 )
MAX_BACKUPS=5 cd /mnt/data/dietpi-backup if [[ -d dietpi-backup ]]; then rm dietpi-backup-$MAX_BACKUPS for ((i=$MAX_BACKUPS-1;i>1;i--)); do mv dietpi-backup-$i dietpi-backup-$( (( $i+1 )) ) done mv dietpi-backup dietpi-backup-2 fi /DietPi/dietpi/dietpi-backup 1
I would like to create maximum 5 backup folders and always delete the oldest one (I would run the script with crontab). However, that script ends to just do a dietpi-backup and never creates new folders but overwrites the same one (definitely not what I wanted).
Maybe someone could reply what is the issue
referring to your OP question, maybe because making a backup is rather trivial. But apart from the question what you want to back up, there are many issues to consider, e.g., media, redundancy, security, versioning, frequency, selectivity, location, longevity, accessibility, reversibility, etc. There is no unique solution and it requires a conscious decision depending very much on the criticality and relevance of the data that you would like to preserve.
On the other hand, I also have to say that when I ask family and friends if they make backups of their data the answer is always no! In most cases this is because they lack the know-how, but in any case they do not realise the potential impact of data loss. But these are also people that will not mess with Dietpi.
I don’t know about that script, but here’s a suggestion. Create your 5 backup folders manually. Set 5 different cron-jobs, one for each folder/file, staggered at the interval you want. Backup folder 1 writes today and then overwrites every 6th week, folder 2 starts next week and then overwrites every 6th week, folder 3 starts in two weeks and then overwrites every 6th week, etc.
Perhaps a little clumsy, but it’s just 5 simple operations that should accomplish exactly what you describe.
brtravel Thank you for your message. It is indeed a nice idea that should be easy to implement though not “elegant” maybe ?!
I will work on that since I don’t have any better options given that that script does not work to me
The script should do what you want. It moves/renames the old backups with +1 integer suffix and only removes the oldest one. Then it creates a new backup. Some posts down the thread you linked I posted another version where the oldest backup is renamed to match the default dir, so the new backup is created by only syncing changes incrementally. By this you have least disk writes.
The auto-backup script is working fine on all 3 devices of mine that run DietPi.
Maybe you could add it optionally as a feature in a next release?
It’s on the list: https://github.com/MichaIng/DietPi/issues/1785
But currently I don’t find much time to implement it, also because there is some more work to do with DietPi-Backup and/or DietPi-Sync in general, and I am not yet 100% sure about how the solution should look like.
I collected some thoughts and after v6.29 will publish them here and/or on GitHub do have you guys voting for a certain solution/implementation.
Why not add support for UrBackup Client since we support the server already. That way I can have a dedicated SBC to back up my other SBC systems that’s not directly connected over the network. Reopen https://github.com/MichaIng/DietPi/issues/678
No a bad idea. I mean generally I like to have our lightweight script to serve basic backup functionality and increase those when we can, but adding other backup clients, especially where we offer the server as install option already, sounds reasonable. But to be true I am currently overloaded with other work. I guess the UrBackup client install on DietPi will work like on any other Debian, similar simple and hassle-less as the UrBackup server. So you could try to just follow their Debian/Ubuntu install instructions and either share your experience/steps here or, even open a PR to implement into dietpi-software: https://github.com/MichaIng/DietPi/wiki/How-to-add-a-new-software-title