VM Backup Plugin


Recommended Posts

44 minutes ago, Kilrah said:

Exclude that whole VM in the plugin's settings?

No, just exclude one of the disks. I'm passing through a 1TB drive and I believe that drive is causing the snapshot to fail. I don't want to backup the 1TB drive either, just the main virtual disk. 

2022-10-30 15_53_33-Tower_UpdateVM.png

Edited by photomatix
typo
Link to comment
  • 3 weeks later...

Anyone knows why the VM doesn't start back after backup?

v0.2.3 - 2021/03/11

 

So, the backup runs as planned, finishes but the VM does not start again - I have to do it manually.

At first it wasn't working for couple of days then it started working by its own (the VM started after backup) then I had to backup another VM so I just selected that one, finished the backup then reverted backing up only this one - after that it stopped starting after backup.

 

Any ideas?

 

Here are the configurations: 

image.thumb.png.b3618ada35ab31cd022ba0594f09304f.png

image.thumb.png.8d16412695b51b012c4506f4e161a791.png

 

 

Link to comment

Hiya!

 

I am attempting to run Emilien-Lamberts script to restore an ubuntu VM.  I have several good backups to choose from.  The problem is that my dumb@$$ used spaces in the name so the script is not creating the restore directory properly nor does it appear to find the backup files:

 

#################################################
Make sure the informations is correct this script does not check errors.

Please check this before continuing.
1) On the dashboard, delete your VM if it still exists ('Remove VM & Disks)'
2) Make sure all VMs are shut down'
3) Make sure your VMs Manager is turned ON before launching this operation.
   (settings => VM Manager => Enable VMs: Yes)
#################################################
Enter path of virtual machine backup folder, for eg:
/mnt/user/John-Doe/my_backup_folder
...

Path without the last / like this: 
/mnt/user/PATH_BACKUP_FOLDER

Path of backup folder: /mnt/user/backups/vms/Ubuntu\ (bbs\ website)  

#################################################
Enter name of virtual machine, like:
Ubuntu

Name of vm folder: Ubuntu (bbs website)

#################################################
Enter date of backup, for eg:
20220124_0200_Ubuntu (bbs website).xml
20220124_0200_vdisk1.img or .zst
...

Date like this: 
20220124_0200

Date of backup: 20221120_0630


#################################################
Checking information :
Your backup path is: /mnt/user/backups/vms/Ubuntu (bbs website)
Your vm name is: Ubuntu (bbs website)
Your backup date is: 20221120_0630

Are You Sure? [Y/n] y

Creation VM folder in domains directory
mkdir /mnt/user/domains/Ubuntu (bbs website)

mkdir: cannot create directory ‘/mnt/user/domains/Ubuntu’: File exists
mkdir: cannot create directory ‘(bbs’: File exists
mkdir: cannot create directory ‘website)’: File exists
!!! Backup file not found !!!
root@GothamCity:/mnt/user/backups/Unraid-VM-Backup-Plugin-Restoration-Script#

 

Any thoughts on how can I get past this?

 

Thanks!

 

Link to comment

Hi all ,

I am runing this plugin to backup a win 10 . so far so good . but on windows 2019 it fales . 
It seems that its not able to shutdown . When i do the shutdown before i run the backup it works . Any idea  ?

Below the logs .

2022-11-22 14:47:21 information: Server 2K19 SQL is running. vm desired state is shut off.
2022-11-22 14:47:21 information: cycle 19 of 20: waiting 30 seconds before checking if the vm has entered the desired state.
2022-11-22 14:47:51 information: Server 2K19 SQL is running. vm desired state is shut off.
2022-11-22 14:47:51 information: cycle 20 of 20: waiting 30 seconds before checking if the vm has entered the desired state.
2022-11-22 14:48:21 information: Server 2K19 SQL is running. vm desired state is shut off.
2022-11-22 14:48:21 failure: Server 2K19 SQL is running. vm desired state is shut off. can_backup_vm set to n.
2022-11-22 14:48:22 information: actually_copy_files is 1.
2022-11-22 14:48:22 information: vm_state is running. vm_original_state is running. starting Server 2K19 SQL.
2022-11-22 14:48:22 warning: vm_state is running. vm_original_state is running. unable to start Server 2K19 SQL.
2022-11-22 14:48:22 failure: backup of Server 2K19 SQL to /mnt/user/backup-sql/Server 2K19 SQL failed.

Link to comment

Hey all, I've just got a quick question about the snapshots feature and was curious if this is expected behavior. I'm still new to Unraid and trying to learn and get used to everything.

 

I currently have snapshots enabled in the plug-in and as a test, I backed up a powered on Ubuntu VM. It creates the VM.snap file and everything works as expected. Here is the log file with only references to the snapshot capability.

 

2022-11-24 01:03:44 information: use_snapshots is 1. vms will be backed up using snapshots if possible.

2022-11-24 01:03:44 information: snapshot_extension is snap. continuing.

2022-11-24 01:03:44 information: snapshot_fallback is 0. snapshots will fallback to standard backups.

2022-11-24 01:03:44 information: skip_vm_shutdown is false and use_snapshots is 1. skipping vm shutdown procedure. ubuntu is running. can_backup_vm set to y.

2022-11-24 01:03:44 information: able to perform snapshot for disk /mnt/vm_cache/domains/ubuntu/vdisk1.img on ubuntu. use_snapshots is 1. vm_state is running. vdisk_type is raw

2022-11-24 01:03:44 information: qemu agent not found. disabling quiesce on snapshot.
Domain snapshot ubuntu-vdisk1.snap created

2022-11-24 01:03:44 information: snapshot command succeeded on vdisk1.snap for ubuntu.

2022-11-24 01:04:34 information: commited changes from snapshot for /mnt/vm_cache/domains/ubuntu/vdisk1.img on ubuntu.
removed '/mnt/vm_cache/domains/ubuntu/vdisk1.snap'
2022-11-24 01:04:34 information: forcibly removed snapshot /mnt/vm_cache/domains/ubuntu/vdisk1.snap for ubuntu.

 

Since this was a test snapshot, I did not have the QEMU guest agent installed in this VM. Thus, quiesce was disabled.

 

As you can tell, after the snapshot is complete, the snapshot (.snap) file is removed. I'm wondering, is this expected behavior and supposed to happen?

 

I ask as I'm used to VMware-style snapshots where they are saved and the snapshots can be kept for N-period of time. I filtered through this topic and read all snapshot-related threads, and it's making me believe this is how it is supposed to work. I'm just wanting to confirm and be 100% sure I'm understanding everything before I start creating regular backup schedules.

 

For anyone interested, I'm running Unraid 6.11.4 and so far, this plug-in has been an absolute lifesaver!

 

Any input, confirmation, and/or other info would be greatly appreciated. 😀

Edited by Evolze
Link to comment
On 11/17/2022 at 8:43 AM, Maruco said:

Anyone knows why the VM doesn't start back after backup?

v0.2.3 - 2021/03/11

 

So, the backup runs as planned, finishes but the VM does not start again - I have to do it manually.

At first it wasn't working for couple of days then it started working by its own (the VM started after backup) then I had to backup another VM so I just selected that one, finished the backup then reverted backing up only this one - after that it stopped starting after backup.

 

Any ideas?

 

Here are the configurations: 

image.thumb.png.b3618ada35ab31cd022ba0594f09304f.png

image.thumb.png.8d16412695b51b012c4506f4e161a791.png

 

 

I'm having the same issue. Started happening last saturday 26.11.

Noticed this on the log from last night.

2022-11-28 04:27:40 information: skip_vm_shutdown is false. beginning vm shutdown procedure.
2022-11-28 04:27:40 information: xxxyyyy is shut off. vm desired state is shut off. can_backup_vm set to y.
2022-11-28 04:27:40 information: actually_copy_files is 1.
2022-11-28 04:27:40 information: can_backup_vm flag is y. starting backup of xxxyyyy configuration, nvram, and vdisk(s).
2022-11-28 04:27:40 information: copy of xxxyyyy.xml to /mnt/user/backup/xxxyyyy/20221128_0400_xxxyyyy.xml complete.
2022-11-28 04:27:40 information: copy of /etc/libvirt/qemu/nvram/XXXXX_VARS-pure-efi.fd to /mnt/use
r/backup/xxxyyyy/20221128_0400_XXXXX_VARS-pure-efi.fd complete.
2022-11-28 04:50:14 information: copy of /mnt/disks/XXXXXDISK/domains/Ubuntu/vdisk1.img to /mnt/user/backup/xxxyyyy/20221128_
0400_vdisk1.img complete.
2022-11-28 04:50:15 information: backup of /mnt/disks/XXXXXDISK/domains/Ubuntu/vdisk1.img vdisk to /mnt/user/backup/xxxyyyy/2
0221128_0400_vdisk1.img complete.
2022-11-28 04:50:15 information: extension for /mnt/cache/gparted-live-1.1.0-1-i686.iso on xxxyyyy was found in vdisks_extensions_
to_skip. skipping disk.
2022-11-28 04:50:15 information: the extensions of the vdisks that were backed up are img.
2022-11-28 04:50:15 information: vm_state is shut off. vm_original_state is shut off. not starting xxxyyyy.
2022-11-28 04:50:15 information: backup of xxxyyyy to /mnt/user/backup/xxxyyyy completed.

So apparently somehow the script fails to write the on/off state prior backing up, since it states "vm_state is shut off. vm_original_state is shut off. not starting xxxyyyy."

Other vm's get properly booted up.

EDIT: Works again after rebooting

Edited by ReLe
Link to comment

So I thought I had this worked out, but I guess not....
Mine was running fine until recently, where it's stopped backing up automatically. If I run the backup manually, it works fine. All VMs stop, backup, and restart as expected.  However, if the job runs as scheduled, it fails and I get a notification on the dashboard that the backup failed to run, but it doesn't say why.  l've tried looking at the logs, but they are set to clear after 1, and I had already run a manual backup, so I have to wait until it fails again, which I believe will be tomorrow.

Any idea what would cause a failure when scheduled, but work fine when run manually?

Link to comment
On 8/23/2022 at 6:10 AM, IronBeardKnight said:

I have discovered what I think may be a bug with this plugin.

 

I'm sure this one could be a simple fix but its possible I might be missing something.
 

Using 2 for this field allows the plugin to work as expected.

 

for some reason I cannot select 1 backup for the amount of copies as I only want one backup and then I use other tools to ship a copy encrypted offsite.

 

Please see below how it turns read then will not allow you apply 1 even thought the vm only has 1 vdisk.

 

 

I have this problem as well. I ended up editing the number_of_backups_to_keep var in the user-script.sh script directly.

 

 

 

Link to comment
9 hours ago, ncohafmuta said:

I have this problem as well. I ended up editing the number_of_backups_to_keep var in the user-script.sh script directly.

 

On 8/23/2022 at 5:10 AM, IronBeardKnight said:

I have discovered what I think may be a bug with this plugin.

 

I'm sure this one could be a simple fix but its possible I might be missing something.
 

Using 2 for this field allows the plugin to work as expected.

 

for some reason I cannot select 1 backup for the amount of copies as I only want one backup and then I use other tools to ship a copy encrypted offsite.

 

Please see below how it turns read then will not allow you apply 1 even thought the vm only has 1 vdisk.

 

You cannot proceed and press apply when its red.



@ncohafmuta and @IronBeardKnight you can bypass pretty much every safety check that won't actually break the script in the Danger Zone tab.
Scroll all the way to the bottom and look for Disable restrictive validation and set it to Yes, after that you can set Number of backups to keep to 1 without the script complaining (screenshots attached).

image.thumb.png.e13580882965a102b05981df6f09d26f.png
image.png.12763a12eace4872088463449286110b.png

 

I am intending to update the help to note which fields can be deactivated and where to do that in a future update, but for now hopefully this helps. 

 

fwiw, the plugin is very customizable and I didn't want to prevent anyone from doing something just because I considered it non-standard (this is one of my biggest pet-peeves with software!). Because of that, I made sure to include options to disable anything that wasn't explicitly breaking. The only reason it doesn't let you do it out of the box is because it is too easy for someone who just wants an easy-to-use backup plugin to make a mistake that doesn't protect them or causes data issues.

I highly recommend reading through the help for the more advanced options if you ever run into something like this again... or even just for good measure - there may be other useful things in there you want to use!

Edited by JTok
  • Like 1
Link to comment
On 12/26/2022 at 11:51 AM, shpitz461 said:

Hi everyone, if I don't actually have any vdisks and passing-through SSD's, what would be the best way to backup my VM's?

 

Two Windows VM's, Win10 and Win11.

 

Thanks!

 

To answer myself, I'm running UrBackup and doing an image, seems to be working fine for what I need.

Link to comment
On 12/30/2022 at 11:21 PM, JTok said:

 



@ncohafmuta and @IronBeardKnight you can bypass pretty much every safety check that won't actually break the script in the Danger Zone tab.
Scroll all the way to the bottom and look for Disable restrictive validation and set it to Yes, after that you can set Number of backups to keep to 1 without the script complaining (screenshots attached).

 

I am intending to update the help to note which fields can be deactivated and where to do that in a future update, but for now hopefully this helps. 

 

fwiw, the plugin is very customizable and I didn't want to prevent anyone from doing something just because I considered it non-standard (this is one of my biggest pet-peeves with software!). Because of that, I made sure to include options to disable anything that wasn't explicitly breaking. The only reason it doesn't let you do it out of the box is because it is too easy for someone who just wants an easy-to-use backup plugin to make a mistake that doesn't protect them or causes data issues.

I highly recommend reading through the help for the more advanced options if you ever run into something like this again... or even just for good measure - there may be other useful things in there you want to use!

 

thank you very much. i'll try this out

EDIT: this worked fine

Edited by ncohafmuta
issue update
Link to comment
  • 3 weeks later...
On 12/20/2021 at 4:21 AM, dja said:

HOW TO RESTORE!!!!


Option 1- Script:
Use the great script from @petchav, many thanks! See the video below for a guide on how to use this. 

 


Option 2- Manual restore:

You will need:
1.  Your backup .img file (after extraction)
2.  Backed up XML file
3.  Your backed up .fd file

Step 1- In terminal, extract img file from .zst backup. Example below. Replace with your .zst file name. 

zstd -d -C --no-check 20211114_0300_vdisk1.img.zst


You will likely get the error below IF you run the command above without --no-check

 Decoding error (36) : Restored data doesn't match checksum


*Note, -no-check option MAY NOT be supported by Unraid.  If this doesn't work in terminal, try Cygwin (Windows) and run it. https://www.cygwin.com. Place your .zst file in the c:\Cygwin folder.  With Windows you can now also install a Linux environment as well. (Beyond scope of this guide!) Copy the backup to the local machine or it will take forever!

ALSO- you can backup WITHOUT compression and save yourself some grief!!! (See options)

 

Step 2- Place .img file back into directory where it was backed up from. Look in the backed up XML file for the following line and ensure that YOUR path AND files exist:
image.png.0ce1f33b2b30e01b29070e405d6e2118.png

Step 3- Place backed up .fd file to: (file name may vary)

/etc/libvirt/qemu/nvram/4a2b120f-0ea9-846a-6e11-f097002e442d_VARS-pure-efi.fd

You may need to remove the 14 character timestamp at the start of the filename!!

For example, remove 20211205_0300_ 
20211205_0300_4a2b120f-0ea9-846a-6e11-f097002e442d_VARS-pure-efi.fd

Step 5- verify ALL files are where they were BEFORE the backup.  Look at XML file for file locations. 
Step 6- Open  your .xml file. Copy the contents. Don't mess with it! 

Step 7- Create a new VM in Unraid.  When asked, it does NOT matter what type, (Win11, 10 etcetera..) just pick one. Once you do that and BEFORE hitting "Create", you will have the VM options page. Select the "Form View" button at top right of screen. Change to  XML view. Select all contents and delete. Paste contents of backed up XML in. Select create and away you go! 

 

Came across the VM backup plugin, doing tests with it n so far me likes it. As for restoration I'd rather go the second option-it's far less technical than the script way. I feel the script is better for batch restores.

Link to comment
6 hours ago, Kich902 said:

Came across the VM backup plugin, doing tests with it n so far me likes it. As for restoration I'd rather go the second option-it's far less technical than the script way. I feel the script is better for batch restores.

One thing I will warn- if you are using qemu to convert image files like vdi, vdmk or qcow2...be careful to specify all the variables correctly as the resulting backup can result in a broken archive that you CAN'T restore because  zstd will see it as having corrupt blocks and crash out. This is mostly a concern when you expand a image file and don't specify file type. (qemu will warn you also..)  If you are just working with standard images created on UNRAID I don't think you'll have an issue.  I would recommend verifying your backups from time to time.

Link to comment

There doesn't seem to be anyway to disable this plugin other than perhaps removing it. I have tried setting backup frequency to "Disabled" and also setting enabled to "No".

 

1529259675_Screenshot2023-01-23at8_28_34PM.thumb.png.76f468f140bd44d951375b324a362593.png

 

 

If I apply the setting and then return to the settings menu later they are reset to "weekly" and "Yes".

 

755394671_Screenshot2023-01-23at8_29_05PM.thumb.png.1a1a6efb39231cf336db0ed041626c53.png

 

Am I missing something?

Link to comment
12 hours ago, wgstarks said:

There doesn't seem to be anyway to disable this plugin other than perhaps removing it. I have tried setting backup frequency to "Disabled" and also setting enabled to "No".

 

 

 

 

If I apply the setting and then return to the settings menu later they are reset to "weekly" and "Yes".

 

Am I missing something?

I ran into a similar issue eventually re-installing it.  However- I believe you can set 'back up all VMs' to 'no' and make sure no VMs are selected.

Link to comment
7 minutes ago, dja said:

I ran into a similar issue eventually re-installing it.  However- I believe you can set 'back up all VMs' to 'no' and make sure no VMs are selected.

Thanks. I wound up just deleting the plugin since I don’t currently have any VMs installed anyway. I really think that setting enabled to “No” should have disabled the plugin though.

Link to comment

At some point in the last couple/few months my backups started taking longer e.g. it takes about 40 minutes to copy this 50GB disk image:

1642109712_Screenshot2023-01-30at11_59_08AM.thumb.png.c31721b73f358b190318c70b9dabadeb.png

 

I remember fixing this a year or two ago by disabling rsync to the extent possible.

It's still disabled:

1089802405_Screenshot2023-01-30at11_58_2AM.png.26f11b85501aa059caa2903e63bd270a.png

 

But the log entry above and grafana, which shows mostly reads on both the source (as expected) AND destination (Active -> Array) during the backup period, suggests it's using rsync.

156079559_Screenshot2023-01-30at12_16_05PM.thumb.png.44967b6d3660f4582c00931e1daac4fe.png

 

Any ideas? I have reconstruct write enabled but even if reporting tracks that as reads I doubt the above shows a copy operation. 12MB/s write is well below my array's capacity.

Edited by CS01-HS
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.