Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

unraid-autovmbackup: automate backup of virtual machines in unRAID - v0.4

Featured Replies

run in conjunction with appdata backup with CA.

 

Is there any chance of adding VM backup natively into CA's backup function?

I think this would be the most streamlined way while we await (at some point) getting snapshot's added into the VM manager.

Waiting to hear from danioj on that one.  I don't run VM's so need to get together with him to sort that all out.
  • Replies 229
  • Views 73.9k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Funny you should mention that 😁. I'm getting very close to having a beta version of the script as a plugin available. I'm expecting to have that done in the next few days (maybe even as early as tomor

  • It is official! I finally have the first beta version of the plugin available here:   -JTok

  • My tests with only one VM went fine. Be careful to check the results if you want to use the script with multiple VM's.    I have set the script to run every night, even though the server wil

Posted Images

run in conjunction with appdata backup with CA.

 

Is there any chance of adding VM backup natively into CA's backup function?

I think this would be the most streamlined way while we await (at some point) getting snapshot's added into the VM manager.

Waiting to hear from danioj on that one.  I don't run VM's so need to get together with him to sort that all out.

 

Good deal, thanks for the update and continued development.

 

It's 5 o'clock somewhere, I tossed a "beer" your way!  ;)

Thanks for the beer, man...  They don't go to waste!

 

 

  • 3 weeks later...

Hi Danioj!

 

I have finally found time to play around with this script for my VMs, I used it on a test VM first just to be safe. It all worked perfectly however some of the configuration options confused me slightly (not difficult!)

 

For example the startvm setting, in the config file

 

1) default is 0 but set this to 1 if you would like to start a vm after it has successfully been backed up

 

in the log file while running this set to 1 it shows

 

2) information: start_vm_after_backup is 1 vms will not be started following a successfull backup

 

and the log after the backup shows

 

3) action: start_vm_after_backup is 1. starting Ubuntu.

 

so it looks like the first log note is incorrect noting that if set to 1 the vm will not be restarted. This also applies to killvm and startvm_afterfailure

 

other than that it was entirely successful, thanks!

 

  • Author

Hi Danioj!

 

I have finally found time to play around with this script for my VMs, I used it on a test VM first just to be safe. It all worked perfectly however some of the configuration options confused me slightly (not difficult!)

 

For example the startvm setting, in the config file

 

1) default is 0 but set this to 1 if you would like to start a vm after it has successfully been backed up

 

in the log file while running this set to 1 it shows

 

2) information: start_vm_after_backup is 1 vms will not be started following a successfull backup

 

and the log after the backup shows

 

3) action: start_vm_after_backup is 1. starting Ubuntu.

 

so it looks like the first log note is incorrect noting that if set to 1 the vm will not be restarted. This also applies to killvm and startvm_afterfailure

 

other than that it was entirely successful, thanks!

 

Hi Ashe. I am not surprised there are some kinks. Your outcome though is similar to mine, it works - just needs to be cleaned up.

 

I think I will collude somewhat with Andrew and see if I can get it finalised.

 

Ill spend some time on it this week.

The main part is it works as intended. The rest is cosmetic.

 

I was going to look into adding mount / umount for my external backup hdd. Is it something you have considered? I was going to look at adding it to the script or adding a wrapper script to call you script in between mounting and unmounting my drive

This script did not seem to shutdown the VM for me. I had no problem shutting down the VM manually, after which, the script ran fine. Also, I expected the log window to echo the comments as it stepped through the script but, it waited until after my 100GB VM img file was copied and the rest of the script fully executed before showing the echoed comments.

  • Author

This script did not seem to shutdown the VM for me. I had no problem shutting down the VM manually, after which, the script ran fine. Also, I expected the log window to echo the comments as it stepped through the script but, it waited until after my 100GB VM img file was copied and the rest of the script fully executed before showing the echoed comments.

 

The main part is it works as intended. The rest is cosmetic.

 

I was going to look into adding mount / umount for my external backup hdd. Is it something you have considered? I was going to look at adding it to the script or adding a wrapper script to call you script in between mounting and unmounting my drive

 

I did some work on this yesterday. I found a number of bugs based on the comments that have been made to date.

 

I am putting together an update.

2nd cron backup worked fine. The next issue I see is the multiple dated backups taking up considerable space. Will look at deleting after a set number or time period

  • Author

2nd cron backup worked fine. The next issue I see is the multiple dated backups taking up considerable space. Will look at deleting after a set number or time period

 

Would you like to see only one maintained or a simple switch which allows you to choose how many you can keep?

2nd cron backup worked fine. The next issue I see is the multiple dated backups taking up considerable space. Will look at deleting after a set number or time period

I was able to reduce my filesize by gzip.

 

Dan, would be nice to add an automatic gzip to the backup file. Since my VM img is 100GB, the backup is also. After gzip, it reduced to 17GB......quite a difference.

2nd cron backup worked fine. The next issue I see is the multiple dated backups taking up considerable space. Will look at deleting after a set number or time period

 

Would you like to see only one maintained or a simple switch which allows you to choose how many you can keep?

 

I think the switch would be the ideal version.

 

Probably one for the roadmap (if at all) is selecting which vdisks are backed up if multiple are used for one VM. For example, I use a second vdisk on a Windows VM as a one drive disk as there is no one drive docker yet but I don't need that backed up as I sync it to my array and of course in the cloud

2nd cron backup worked fine. The next issue I see is the multiple dated backups taking up considerable space. Will look at deleting after a set number or time period

I was able to reduce my filesize by gzip.

 

Dan, would be nice to add an automatic gzip to the backup file. Since my VM img is 100GB, the backup is also. After gzip, it reduced to 17GB......quite a difference.

 

For simplicity I would prefer any compression to be optional but I could see it being a useful option for some

Thanks for the script, very useful.

 

One suggestion, since vdisks by default are sparse use --sparse on rsync (or cp instead) to make the backups, say you have a 120GB vdisk but only 20GB are allocated, the way it is now the backup will use 120GB, with --sparse or cp it would only use 20GB.

 

 

  • Author

Thanks for the script, very useful.

 

One suggestion, since vdisks by default are sparse use --sparse on rsync (or cp instead) to make the backups, say you have a 120GB vdisk but only 20GB are allocated, the way it is now the backup will use 120GB, with --sparse or cp it would only use 20GB.

 

Thanks. Excellent suggestion.

 

I will probably use the rsync switch.

  • 2 weeks later...

Thanks for the script, very useful.

 

One suggestion, since vdisks by default are sparse use --sparse on rsync (or cp instead) to make the backups, say you have a 120GB vdisk but only 20GB are allocated, the way it is now the backup will use 120GB, with --sparse or cp it would only use 20GB.

 

Thanks. Excellent suggestion.

 

I will probably use the rsync switch.

 

Great work on this  :)

 

Or maybe you could export the disks using

 

qemu-img convert -O output_format source destination

I know I'm probably doing something daft (again), but can someone tell me why the script isn't running please.

 

In CA I've got '/boot/unraid-autovmbackup-0-4.sh' in 'Path to custom start script' and I've got the /mnt/user/backup/vm_backup/ folder all setup ready to receive backups.

 

Thanks in advance

unraid-autovmbackup-0-4.zip

Without looking at the script, when you set the path does it throw up any errors?

(i'll also check CA to make sure that part of it is still working because AFAIK you're the first to use it)

 

Sent from my LG-D852 using Tapatalk

 

Without looking at the script, when you set the path does it throw up any errors?

(i'll also check CA to make sure that part of it is still working because AFAIK you're the first to use it)

 

Sent from my LG-D852 using Tapatalk

 

Where would I check for script errors?  Sorry, not very technical and new to unraid/linux

It would be In red at the top of the backup settings.  Only makes sure it exists is executable etc.  Doesn't check anything else

 

Sent from my LG-D852 using Tapatalk

 

 

It would be In red at the top of the backup settings.  Only makes sure it exists is executable etc.  Doesn't check anything else

 

Sent from my LG-D852 using Tapatalk

 

Don't think I'm getting any errors.  Just ran backup again and in the status window it said:

 

Backup / Restore Status: Running Your docker containers will be automatically restarted at the conclusion of the backup/restore 
Executing custom stop scriptStopping binhex-couchpotato
Stopping binhex-delugevpn
Stopping binhex-plexpass
Stopping binhex-sabnzbd

 

(cut and paste exactly i.e. no space between 'script' and 'Stopping binhex...')

Since I don't run VM's, I can't really help with the actual script.

 

But, I can tell you that the start and stop scripts do execute at the appropriate times (before docker stops and after docker starts)

 

When I originally added in the hooks for the scripts, I was expecting people to use (in bash) either the logger command to output to the syslog, or manually specify redirection on echo's.  After seeing your output sample (minor issue with no newline after the executing note), I can see that I should force any echo's from the script to my log file so that it'll display in that backup status by default.  Will update CA in about 5 minutes.

 

Beyond that, does the script that you've got actually work calling it manually from the command line?

Since I don't run VM's, I can't really help with the actual script.

 

But, I can tell you that the start and stop scripts do execute at the appropriate times (before docker stops and after docker starts)

 

When I originally added in the hooks for the scripts, I was expecting people to use (in bash) either the logger command to output to the syslog, or manually specify redirection on echo's.  After seeing your output sample (minor issue with no newline after the executing note), I can see that I should force any echo's from the script to my log file so that it'll display in that backup status by default.  Will update CA in about 5 minutes.

 

Beyond that, does the script that you've got actually work calling it manually from the command line?

 

I don't know how to run scripts manually, so I worked out how to add it to the user scripts plugin.  it fails:

 

failure: official_script_name is unraid-autovmbackup-0-4.sh. script name is invalid. exiting.

 

But it could be because I've done something wrong.

Looks like using user.scripts, you'd have to change the line

official_script_name="unraid-autovmbackup-0-4.sh"

to be

official_script_name="script"

  Not quite sure why danioj would be a test on the name of the script though  :o

 

To execute it manually, just type in at a console

/boot/unraid-autovmbackup-0-4.sh

  • Author

Sorry for the delays guys. I've been working interstate past couple of weeks and am in Sydney now.

 

I have a new version running on my servers at home. If they have run without error when I get back I shall upload. I think I've ironed out much of the remaining bugs.

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.