Emilien-Lambert / Unraid-VM-Backup-Plugin-Restoration-Script

A bash script to automate the restoration of a virtual machine that has been backed up with the VM-Backup plugin on a Unraid server
MIT License
23 stars 8 forks source link

Feature .qcow2 file #6

Open servebeer opened 1 year ago

servebeer commented 1 year ago

Thanks for the script as this saved me a lot of time! There are two features that I would like to see added:

1) Built-in support for Windows VMs that contain TPMs. Currently, you have to manually rename the image files. 2) Built-in support for non-img image files (i.e. qcow2)

Thanks! Jon

Emilien-Lambert commented 1 year ago

Hi @servebeer.

I currently don't own any Unraid servers, so I don't have the option of testing the script if I make any changes.

The modification to rename files is quite simple, so I'll add it as soon as I have a moment.

On the other hand, the modification to manage qcow2 images is perhaps a little more complex. I have no idea whether the restoration process is the same for qcow2 images.

The simplest thing would be for you to modify the condition in the script to add, accept .qcow2 and if your restore works well, then I'll add this possibility to the script.

https://github.com/Emilien-Lambert/Unraid-VM-Backup-Plugin-Restoration-Script/blob/c88eee15866a5d8cf8b36372f8f2878adf474ece/vm_backup_restoration.sh#L107

servebeer commented 1 year ago

Thanks for the quick response! I have verified that simply changing .img to .qcow2 works in my environment.v/rJonOn Aug 14, 2023, at 14:08, Emilien Lambert @.***> wrote: Hi @servebeer. I currently don't own any Unraid servers, so I don't have the option of testing the script if I make any changes. The modification to rename files is quite simple, so I'll add it as soon as I have a moment. On the other hand, the modification to manage qcow2 images is perhaps a little more complex. I have no idea whether the restoration process is the same for qcow2 images. The simplest thing would be for you to modify the condition in the script to add, accept .qcow2 and if your restore works well, then I'll add this possibility to the script. https://github.com/Emilien-Lambert/Unraid-VM-Backup-Plugin-Restoration-Script/blob/c88eee15866a5d8cf8b36372f8f2878adf474ece/vm_backup_restoration.sh#L107

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Emilien-Lambert commented 1 year ago

I've added the 2 improvements, but I can't test it.

Please try the script from this branch: feature-qcow2

If you confirm that it restores "-tpm" files without errors and that it works correctly with ".qcow2" files, I'll put the improvement on the main branch.

Emilien-Lambert commented 1 year ago

Hi @servebeer did you have time to try the modification I made for you?

servebeer commented 1 year ago

@Emilien-Lambert , sorry for the delay. I have been battling AT&T over Internet issues recently. They are supposed to come on-prem today and fix it. If so, I will look into this tomorrow and let you know how it works out.

servebeer commented 1 year ago

I believe that it is now working. Here are the latest logs...

2023-09-10 04:33:48 information: skip_vm_shutdown is false and use_snapshots is 1. skipping vm shutdown procedure. OpenManage is shut off. can_backup_vm set to y. 2023-09-10 04:33:48 information: actually_copy_files is 1. 2023-09-10 04:33:48 information: can_backup_vm flag is y. starting backup of OpenManage configuration, nvram, and vdisk(s). 2023-09-10 04:33:48 information: copy of OpenManage.xml to /mnt/user/vmbackup/OpenManage/20230910_0300_OpenManage.xml complete. 2023-09-10 04:33:48 information: OpenManage does not appear to have an nvram file. skipping. 2023-09-10 04:33:48 information: unable to perform snapshot for disk /mnt/user/domains/OpenManage/20230730_0300_openmanage_enterprise.qcow2 on OpenManage. falling back to traditional backup. use_snapshots is 1. vm_state is shut off. vdisk_type is qcow2. 2023-09-10 04:39:37 information: copy of /mnt/user/domains/OpenManage/20230730_0300_openmanage_enterprise.qcow2 to /mnt/user/vmbackup/OpenManage/20230910_0300_20230730_0300_openmanage_enterprise.qcow2.zst complete. 2023-09-10 04:39:37 information: backup of /mnt/user/domains/OpenManage/20230730_0300_openmanage_enterprise.qcow2 vdisk to /mnt/user/vmbackup/OpenManage/20230910_0300_20230730_0300_openmanage_enterprise.qcow2.zst complete. 2023-09-10 04:39:37 information: beginning copy of extra files in path: /mnt/user/domains/OpenManage for VM OpenManage. 2023-09-10 04:39:37 information: copy of backup of /mnt/user/domains/OpenManage//20230730_0300_OpenManage.xml file to /mnt/user/vmbackup/OpenManage//20230910_0300_20230730_0300_OpenManage.xml starting. 2023-09-10 04:39:37 information: copy of /mnt/user/domains/OpenManage//20230730_0300_OpenManage.xml to /mnt/user/vmbackup/OpenManage//20230910_0300_20230730_0300_OpenManage.xml complete. 2023-09-10 04:39:37 information: /mnt/user/domains/OpenManage/20230730_0300_openmanage_enterprise.qcow2 on OpenManage is a vdisk. skipping file. 2023-09-10 04:39:37 information: the extensions of the vdisks that were backed up are qcow2. 2023-09-10 04:39:37 information: vm_state is shut off. vm_original_state is shut off. not starting OpenManage. 2023-09-10 04:39:37 information: backup of OpenManage to /mnt/user/vmbackup/OpenManage completed. 2023-09-10 04:39:37 information: cleaning out backups older than 180 days in location ONLY if newer files exist in /mnt/user/vmbackup/OpenManage/ 2023-09-10 04:39:37 information: did not find any config files to remove. 2023-09-10 04:39:38 information: did not find any nvram files to remove. 2023-09-10 04:39:38 information: did not find any vdisk image files to remove. 2023-09-10 04:39:38 information: did not find any vm log files to remove. 2023-09-10 04:39:38 information: cleaning out backups over 2 in location /mnt/user/vmbackup/OpenManage/ 2023-09-10 04:39:38 information: removed '/mnt/user/vmbackup/OpenManage/20230903_0300_20230730_0300_OpenManage.xml' config file. 2023-09-10 04:39:38 information: removed '/mnt/user/vmbackup/OpenManage/20230903_0300_OpenManage.xml' config file. 2023-09-10 04:39:38 information: did not find any nvram files to remove. 2023-09-10 04:39:39 information: removed '/mnt/user/vmbackup/OpenManage/20230827_0300_20230730_0300_openmanage_enterprise.qcow2.zst' vdisk image file. 2023-09-10 04:39:39 information: removed '/mnt/user/vmbackup/OpenManage/20230827_0300_unraid-vmbackup.log' vm log file.

Emilien-Lambert commented 1 year ago

Uh, what are the logs for? Because my script doesn't write those kind of logs. When you run the script, does it finish correctly, with no errors?

servebeer commented 1 year ago

The logs came from here: /SETTINGS/VM Backup/SHOW LOG. Am I confusing a built-in feature with your script?

Emilien-Lambert commented 12 months ago

I think I have. In fact, I'm not the author of the plugin that lets you create backups from the Unraid interface. In fact, the person(s) who made the backup plugin created the tools that allow you to back up, but not to restore the backup. (No idea why this wasn't done.) Anyway, the normal way to restore a backup is to execute a number of commands and move, rename etc, the backup files manualy.

I simply created a script that automates this. Now, it seems that your backup isn't working for a configuration reason unknown to me.

If you didn't get an error log in the terminal or you ran ./vm_backup_restoration.sh

This means that the backup files have been correctly moved. Now if the VM etc doesn't start, the problem is probably with the plugin itself.

To do this, I suggest you ask your question in the forum dedicated to the plugin. The people in charge of the plugin will certainly have some solutions to suggest, concerning your configuration with .qcow2 files. Here

servebeer commented 12 months ago

Thanks for the follow-up. I was afraid that I had confused two different things :-( As soon as I get back home (I am traveling on business right now), I will look at this some more.

V/r Jon

On Sep 19, 2023, at 11:36, Emilien Lambert @.***> wrote:

I think I have. In fact, I'm not the author of the plugin that lets you create backups from the Unraid interface. In fact, the person(s) who made the backup plugin created the tools that allow you to back up, but not to restore the backup. (No idea why this wasn't done.) Anyway, the normal way to restore a backup is to execute a number of commands and move, rename etc, the backup files manualy.

I simply created a script that automates this. Now, it seems that your backup isn't working for a configuration reason unknown to me.

If you didn't get an error log in the terminal or you ran ./vm_backup_restoration.sh https://github.com/Emilien-Lambert/Unraid-VM-Backup-Plugin-Restoration-Script/blob/main/vm_backup_restoration.sh This means that the backup files have been correctly moved. Now if the VM etc doesn't start, the problem is probably with the plugin itself.

To do this, I suggest you ask your question in the forum dedicated to the plugin. The people in charge of the plugin will certainly have some solutions to suggest, concerning your configuration with .qcow2 files. Here https://forums.unraid.net/topic/86303-vm-backup-plugin/page/17/#comment-1277331 — Reply to this email directly, view it on GitHub https://github.com/Emilien-Lambert/Unraid-VM-Backup-Plugin-Restoration-Script/issues/6#issuecomment-1726054120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACA6WJPD4IL6BTEJNPREWODX3HCZ7ANCNFSM6AAAAAA3QA7V24. You are receiving this because you were mentioned.