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

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

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

Post by ghettopi » Fri Sep 13, 2019 11:48 pm

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: 653
Joined: Wed Jun 08, 2016 10:53 am
Location: New Zealand

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

Post by johnvick » Sat Sep 14, 2019 8:15 pm

# dietpi-backup 1

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

John

Garret
Posts: 41
Joined: Sat Nov 10, 2018 11:23 am

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

Post by Garret » Sat Sep 14, 2019 9:20 pm

@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: 2
Joined: Sat Sep 14, 2019 9:17 pm

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

Post by tjamaa » Sat Sep 14, 2019 9:42 pm

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: 29
Joined: Sat Sep 16, 2017 1:04 pm

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

Post by brtravel » Tue Sep 17, 2019 8:36 am

Garret wrote:
Sat Sep 14, 2019 9: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: 41
Joined: Sat Nov 10, 2018 11:23 am

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

Post by Garret » Tue Sep 17, 2019 1:18 pm

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

Post Reply