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

Suggestions for features and software you would like to see in DietPi, goes here.
ghettopi
Posts: 44
Joined: Tue Jul 30, 2019 9:17 pm

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

Post 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.
User avatar
johnvick
Legend
Posts: 693
Joined: Wed Jun 08, 2016 11:53 am
Location: New Zealand

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

Post by johnvick »

# dietpi-backup 1

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

John
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

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

Post 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 :)
tjamaa
Posts: 8
Joined: Sat Sep 14, 2019 10:17 pm

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

Post 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.
brtravel
Posts: 51
Joined: Sat Sep 16, 2017 2:04 pm

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

Post 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.
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

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

Post 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 :)
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

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

Post 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.
trendy
Posts: 122
Joined: Tue Feb 25, 2020 2:54 pm

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

Post 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?
User avatar
MichaIng
Site Admin
Posts: 2294
Joined: Sat Nov 18, 2017 6:21 pm

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

Post 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.
Gigabit
Posts: 27
Joined: Fri Dec 23, 2016 6:28 pm

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

Post 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
Post Reply