[User Script] Automated USB /boot/ backup to another directory


Recommended Posts

I've explored the possibility of calling the already built-in unRAID "backup to ZIP" function, and I've made a shell script, that will call said "backup to ZIP" script and then move the ZIP file to a directory. In my case, I have a Dropbox Docker container running, so I just move the ZIP file to there, and then I have backup of my /boot/ directory exactly like how unRAID does.

 

I couldn't find a lot of information about backing up /boot/, except for the CA backup plugin which I don't like, so I made the shell script from scratch (I am a web developer, so bear with me). 

 

Suggestions are welcome. I think I made it as "noob friendly" as I possibly could. Just create a new User Script, paste in the script below (newest revision), change the path of where you want your ZIP file to end up, and then set a custom schedule using cron (mine does it every 12 hours).

 

---

 

Rev. 001: https://pastebin.com/Jc8wh57P

Rev. 002: https://pastebin.com/3udPK7w8

Rev. 003: https://pastebin.com/mBYQqae2

Edited by mortenmoulder
Link to comment
Just now, jonathanm said:

Why?

 

The reason you haven't seen much movement in the flash backup topic is that Limetech is working on updating that procedure, so any work done by third parties right now is likely to be superseded.

 

It's just a personal preference. It does too much, warns you that your Docker containers, VMs, etc. all need to be stopped, and so on. If all I want is /boot/ backup, it's pretty much overkill to get it. I know other people have said similar things, which I discovered while searching for good ways to backup /boot/. We each have our opinions about these things, fortunately.

 

Great Limetech is working on it. Would be very nice with some built-in S3 off-site backup, that you can run on a schedule. I know it's not top priority, but it's definitely up there in my opinion.

Link to comment

Nice looking script.  The only problem with it though, long term, is that it relies on Unraid's built in functions that may change without notice.  To make it work universally with no "outside dependencies" you should simplify it down to only working with the flash drive and your script, nothing Unraid specific involved.

 

  

On 7/31/2020 at 8:28 AM, Energen said:

Or if for some reason you don't want to use that plugin, you can run a User Script (user scripts plugin :P) to backup your drive also.. I have mine going to a Dropbox share daily.

 


#!/bin/bash

/usr/bin/rsync -avXHg --delete /boot/ /mnt/user/Dropbox/unraid_BootUSB_Backup;
chmod 777 -R /mnt/user/Dropbox/unraid_BootUSB_Backup;

 

 

I use this for file by file backup to Dropbox ... when I get around to it I'll change it to using tar archives as I'm doing with Plex databases.. but the concept will remain the same that it doesn't matter what functions Unraid ever has/uses/changes the script will not break because of those changes.

 

Link to comment
On 2/3/2021 at 12:14 AM, Energen said:

Nice looking script.  The only problem with it though, long term, is that it relies on Unraid's built in functions that may change without notice.  To make it work universally with no "outside dependencies" you should simplify it down to only working with the flash drive and your script, nothing Unraid specific involved.

 

  

 

I use this for file by file backup to Dropbox ... when I get around to it I'll change it to using tar archives as I'm doing with Plex databases.. but the concept will remain the same that it doesn't matter what functions Unraid ever has/uses/changes the script will not break because of those changes.

 

 

Unfortunately my script relies on unRAID, yep, but I don't like your approach. I actually used your approach for a couple of days, but I just couldn't rely on it (no offense). I much prefer creating an archive, adding the files to it, and then moving that to Dropbox.

 

Since unRAID has a built in function that literally does that, I think it's okay to rely on it. I did add a check to see if it exists, but creating a notification is also flawed, as that script could also move to a different location. Nothing I can do about that, unfortunately.

 

The only thing you need to do after updating unRAID, is check if the script still works. Otherwise it shouldn't change.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.