Help restoring VM Configuration


Recommended Posts

All,

 

I have a major problem I could use assistance with.  I have been running an Ubuntu VM that works great.  In the course of playing around with my network bridging, I disabled VMs in the settings menu, and now that I have turned that back on, I seem to have lost the fact of this Ubuntu VM in the console.  I know the VM image still exists, but the configuration is gone.  What is the best way to recover the settings so that the VM can be restarted?  last thing I want to do is something silly that overlays the existing image with a new install.  Unfortunately, it looks like a new libvirt image was created and replaced the old one for which I don;t have a backup.

 

Would it be possible to just create a new Ubuntu VM that I think matches as best I can recall the configuration of the one I already have, and then edit the XML to pick up the vdisk of the original VM?

Edited by kennelm
Link to comment
16 hours ago, kennelm said:

Would it be possible to just create a new Ubuntu VM that I think matches as best I can recall the configuration of the one I already have, and then edit the XML to pick up the vdisk of the original VM?

Make a backup of the vdisk to be safe. Create a new VM and point it to the already existing vdisk. Set the primary vdisk to manual and enter the path of the existing vdisk during creation of the VM. On default you will find the vdisk in the domain share.

/mnt/user/domains/oldVMNAME/vdisk1.img

 

Link to comment
6 hours ago, bastl said:

Make a backup of the vdisk to be safe. Create a new VM and point it to the already existing vdisk. Set the primary vdisk to manual and enter the path of the existing vdisk during creation of the VM. On default you will find the vdisk in the domain share.


/mnt/user/domains/oldVMNAME/vdisk1.img

 

Thanks for the reply. That is exactly what I decided to do, so your reply validates my approach.   I was just a little leery of doing anything that might ruin the image and prevent a recovery.  I remain confused as to how all this happened.  Does disabling VMs in the settings menu cause this kind of destruction?

 

I did notice that the VM came up with a different network configuration.  It was originally set to a static IP, and it came up with DHCP.  Not sure why.  Otherwise, it seems to be working (fingers crossed).

 

My next step is to look into best practices for backing up the configuration as well as the VM vdisk image.  I found the user script from squid and got that set up.  Appears to be working and making a backup of both my XML and  nvram files.  Now, I just need to figure out the best way to back up the vdisk image.  Maybe that's just a simple cp of the file once the VM is stopped.  I see spaceinvader is suggesting Krusader from sparkyballs...

 

Larry

Edited by kennelm
Link to comment
5 hours ago, kennelm said:

Does disabling VMs in the settings menu cause this kind of destruction?

This shouldn't happen if you disable VMs. The libvirt.img saving the xml and bios infos for the VMs are stored in the system share isn't removed by disabling VMs. It can get corrupted or manual deleted and all your VM settings are gone. It's a good idea to backup the system share from time to time.

 

5 hours ago, kennelm said:

I did notice that the VM came up with a different network configuration.  It was originally set to a static IP, and it came up with DHCP.  Not sure why.  Otherwise, it seems to be working (fingers crossed).

Each VM gets a unique mac adress during creation. Thats the reason, why you got a new IP via DHCP. If you have a static reservation setup on your router for your "old" VMs mac address, you can use that mac and replace the current one in the xml view of the VM. Edit your VM, switch to xml view in the top right and scroll down till you find the interface entry which looks something like this

    <interface type='bridge'>
      <mac address='52:54:12:28:1d:cd'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>

 

5 hours ago, kennelm said:

My next step is to look into best practices for backing up the configuration as well as the VM vdisk image.

You can use the plugin "CA Backup / Restore Appdata" which backs up the libvirt image also the docker image and also the unraid flash disk. If your drive where your vdisks are located is BTRFS you can use the snapshot feature of BTRFS. You will find a couple scripts for that if you search the forums.

 

For specifically backup VMs, there are also a couple scripts which do the job or search for the plugin called "VM Backup"

I use his scripts for over 2 years now and the plugin itself since he released it. Never had any problems with it. Read the help text for each function of the plugin and understand when it's doin what and figure out how you wanna backup your VMs. With or without snapshots, how many to keep, compression or not. Some settings need some extra tweaks you have to do, therefore read each help text carefully.

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.