Page 1 of 2

Auto-backup? Why isn't it a thing?

Posted: Sat Sep 14, 2019 12:48 am
by ghettopi
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.

Re: Auto-backup? Why isn't it a thing?

Posted: Sat Sep 14, 2019 9:15 pm
by johnvick
# dietpi-backup 1

Will backup using your last settings. Write a script, make a cron job.

John

Re: Auto-backup? Why isn't it a thing?

Posted: Sat Sep 14, 2019 10:20 pm
by Garret
@ghettopi I had found this script which seemed to be nice but to me it does not work (taken from viewtopic.php?t=3593#p12507 )

Code: Select all

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 :)

Re: Auto-backup? Why isn't it a thing?

Posted: Sat Sep 14, 2019 10:42 pm
by tjamaa
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.

Re: Auto-backup? Why isn't it a thing?

Posted: Tue Sep 17, 2019 9:36 am
by brtravel
Garret wrote: Sat Sep 14, 2019 10:20 pm 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 :)
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.

Re: Auto-backup? Why isn't it a thing?

Posted: Tue Sep 17, 2019 2:18 pm
by Garret
@brtravel Thank you for your message. It is indeed a nice idea that should be easy to implement though not "elegant" maybe :P ?!

I will work on that since I don't have any better options given that that script does not work to me :)

Re: Auto-backup? Why isn't it a thing?

Posted: Fri Sep 27, 2019 12:37 pm
by MichaIng
@Garret
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.

Re: Auto-backup? Why isn't it a thing?

Posted: Thu Mar 12, 2020 10:16 am
by trendy
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?

Re: Auto-backup? Why isn't it a thing?

Posted: Mon Mar 23, 2020 6:33 pm
by MichaIng
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.

Re: Auto-backup? Why isn't it a thing?

Posted: Tue Mar 24, 2020 4:55 pm
by Gigabit
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