Page 1 of 1

Replace vdi disk of a VM with multiple snapshots

Posted: 13. Nov 2020, 10:07
by fadajo
Hi all,
I had a VM on a disk which has failed yesterday :cry: . But befor failing i have copied the VHDX disk used to create vdi disk and the VM 5 months ago and the VM folder. I have not copied the vdi disk.
I specify that while using the VM i have taken 4 snapshots.
I'm on a new host now and i have to create a new vdi disk from the vhdx disk. But in the virtual manager i can see that the vdi diks of snapshots are listed under the vdi that i have not copied (screenshot added).

My concern is, how can i create a new vdi disk and make it workable for this VM while keeping the screenshots usable? Knowing that the new vdi will have a UUID different of the one registered.

Thanks for your advises.

Re: Replace vdi disk of a VM with multiple snapshots

Posted: 13. Nov 2020, 10:22
by mpack
fadajo wrote: My concern is, how can i create a new vdi disk and make it workable for this VM while keeping the screenshots usable?
I assume screenshots is a typo for snapshots - and this is very unlikely to be possible in my opinion. Not unless you can recreate the base disk PRECISELY from the old VHDX. Then you will have to hack the UUIDs links correctly.

p.s. There is a tool provided with Windows (since Win7 I think) call "WinSnip" (open Start menu and type "Snipping Tool"). This tool is very easy to use, allows you to capture just the portion of the screen you want, and it's much better to use that than rely on fuzzy, barely readable photos of a PC screen.

Re: Replace vdi disk of a VM with multiple snapshots

Posted: 13. Nov 2020, 14:06
by fadajo
Hi @mpack.
Yes "screenshots" is a typo for "snapshots". Sorry also for the fuzzy screenshot. I was in a hurry when i posted the msg. I have reattached a good one.

I have recreate a new vdi file from the old VHDX (same name and same folder); and obviously it could not be recorded in disk manager.

When you say "hack the UUIDs links correctly" i'm thinking about that:
- replace in vbox file, all occurences of the old UUID by the new one
- but also change the parent UUID of the vdi disk of the first snapshot by the new UUID (vboxmanage internalcommands separenthduuid ?)

Am i right? If not please help me to know what to do.
Thanks

Re: Replace vdi disk of a VM with multiple snapshots

Posted: 13. Nov 2020, 14:36
by mpack
fadajo wrote: When you say "hack the UUIDs links correctly" i'm thinking about that:
- replace in vbox file, all occurences of the old UUID by the new one
- but also change the parent UUID of the vdi disk of the first snapshot by the new UUID (vboxmanage internalcommands separenthduuid ?)
That should work (to the extent that the VM will begin to boot, not that it will succeed). Make a backup of the VM before you start.

Re: Replace vdi disk of a VM with multiple snapshots

Posted: 13. Nov 2020, 21:12
by fadajo
It is OK now.
I have made the changes and the vm have started.
I'm doing an export to ovf as backup.

Thanks for your help @mpack.

Re: Replace vdi disk of a VM with multiple snapshots

Posted: 13. Nov 2020, 21:18
by scottgus1
Exporting is not good for backups. Exporting changes all the UUIDs which can cause reactivation and grub loader problems. A changed file cannot be compared back to the original to confirm the integrity of the backup.

A host folder backup of all the files that make up the guest, while the guest is fully shut down not save-stated, is better. This includes everything inside the guest folder and any drive files located outside the folder. A regular FC file-compare checks the backup integrity, and the backup can be restored directly to any capable Virtualbox host.