Tutorial for restoring VMs?


Recommended Posts

Is there a simple or step by step tutorial for backing up and restoring VMs?  I used the plugin to backup some drives but cannot find an understandable procedure on how to restore them.  The spaceinvader video is 6 years old and the Vm Backup support thread link for restoring doesnt make sense. 

Link to comment

there are 2 fd file, one is the ovmf bios, which can be created new, they all are the same. The other is the var fd which contains the efi variables, you can use the backup (by pointing in the xml to the backup vars fd file) if you want to backup the efi variables or you can use a new one, in this case it's like as you do a nvram reset.

  • Like 1
Link to comment

Basically copy xml in a text file, copy vdisk.img, copy the ovmf_vars.fd.

Create a new empty vm and do not start it.

Replace the new xml code with the one from the xml backup.

Check the paths in the code of the xml for the vdisk.img and for the ovmf_vars.fd and change them pointing to that of your backup files.

If the vm fails to start because of the uuid, meaning it's duplicated, delete the uuid line in the xml, libvirt will automatically create a new one.

  • Thanks 1
Link to comment
  • 1 year later...

@ghost82 Following on this thread I am now in the process of restoring a VM.  I am running the backup plugin and have some questions before I do this:

 

I notice in the backup directory that I have several copies by date of the img, xml and fd file.  But the newest img file does not have an xml or an fd file associated with it.  Should I revert back to the next newest file set where all three exist?  Or can I use the xml and fd files from an older backup set?

 

My fd file is not named ovmf_vars.fd but 20240206_0300_5ab648ed-0c63-aa51-400c-277ece7bd277_VARS-pure-efi.fd.  I assume that doesn't matter?

 

Looking at the xml I see a few corrections I might need to make:

 

/mnt/user/domains/Outlook/vdisk1.img - the image is currently in a backups folder - so I will move it to the corresponding folder in domains and leave this as is.

 

Should I do anything with the 20240206_0300_5ab648ed-0c63-aa51-400c-277ece7bd277_VARS-pure-efi.fd file that is currently in the backups folder?

 

Thanks!

Link to comment

Hello @The Transplant

I never used the backup plugin, so I'm sorry but I don't know how this plugin works.

Anyway...

18 hours ago, The Transplant said:

But the newest img file does not have an xml or an fd file associated with it

 

An img file is the disk file.

The xml file contains the emulated hardware and layout of the virtual pc.

The edk2 ovmf code fd file is the bios of your virtual pc.

The edk2 ovmf vars fd file is the nvram of your virtual pc.

You need these 4 things to boot a qemu vm.

 

18 hours ago, The Transplant said:

But the newest img file does not have an xml or an fd file associated with it

 

You should be able to boot the img by recreating the other 3 files; you can copy the ovmf code fd file from another vm (it's the bios, the bios is the same for every vm), and you also can use the ovmf vars fd file copied (better) from the same vm (the vars file can contain nvram variables, such as boot order).

As far as the xml you can create a new vm, so to generate a new xml and change the relevant part of this new xml to point to your img disk file, and fd files; if hardware layout is different than the old xml (for example, you add a new usb virtual controller which was not there in the original vm), windows should be smart enough to not hang. Obviously you need to know if your original vm was a uefi or bios vm, q35 or i 440fx, so you can create the new vm accordingly, using ovmf or seabios nad q35 or i440fx virtual chipsets.

 

19 hours ago, The Transplant said:

My fd file is not named ovmf_vars.fd but 20240206_0300_5ab648ed-0c63-aa51-400c-277ece7bd277_VARS-pure-efi.fd.  I assume that doesn't matter?

Correct, it doesn't matter, unraid applies a prefix with the uid of the vm to the filename.

 

19 hours ago, The Transplant said:

/mnt/user/domains/Outlook/vdisk1.img - the image is currently in a backups folder - so I will move it to the corresponding folder in domains and leave this as is.

Either edit the path to point to that of where the img is, or move the img to that path.

 

19 hours ago, The Transplant said:

Should I do anything with the 20240206_0300_5ab648ed-0c63-aa51-400c-277ece7bd277_VARS-pure-efi.fd file that is currently in the backups folder?

This file should contain some nvram variables, but it shouldn't matter, make sure to check the xml to point to this file.

If it doesn't boot you may need to enter the ovmf bios screen (by pressing esc key on vm boot repeatedly) and change the boot order.

Link to comment

Thanks @ghost82 - I did manage to restore the older file and get it running.  But I had made some changes and want to get the newer image restored so will work through your suggestions above.  

 

The backup script I am using just seems to make a copy of the .img, xml, and .fd file.  It did take me a while to realize that it was appending dates to the front of these files - so you could maintain multiple backups.

 

This feels like something that should be native in the GUI for both dockers and VMs.  Since I had not been through a crash like this it took me down for a number of days while I learned how to restore.  A simple create new VM and click on restore and select the backup would have been nice, and from a software standpoint is remarkably simple to add?

 

I appreciate the help!

Link to comment
17 hours ago, The Transplant said:

I did manage to restore the older file and get it running.  But I had made some changes and want to get the newer image restored so will work through your suggestions above

If an older backup works, just replace the img file with the newer one and it should boot.

  • Like 1
Link to comment
6 hours ago, ghost82 said:

If an older backup works, just replace the img file with the newer one and it should boot.

Thanks - that did work.  Definitely not an experience I would want to repeat.

 

The reason I had to do this in the first place is because 1 of my 2 cache drives failed.  I replaced it but I am still in the process of moving data off the second cache drive onto the new replacement, and then the plan is to mirror this drive to avoid issues like this.

 

This is another daunting task - nothing seems to work as planned.  If you feel inclined to take a look - here is the link to that thread.  Thanks!

 

 

  • Like 1
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.