[Solved] Migrating VHD to VDI

Discussions related to using VirtualBox on Windows hosts.
Post Reply
sterod
Posts: 23
Joined: 30. Apr 2021, 19:08

[Solved] Migrating VHD to VDI

Post by sterod »

H everyone.

This forum recommends that we convert any VHD format to VDI. So I did, and the conversion was easy. However, I could not manage to attach the new VDI to the old virtual machine. Is it possible to do so? Tried to edit the vbox file, but obviously it is not that easy, as the machine would not start.

I tried to create a new virtual machine with the new disk, but the problem is that Microsoft Office and other software recognized this as hardware change, so I would have to go through the process of updating or buying new licenses for lots of software.

Is there any way to attach the new VDI disk to the old virtual machine?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Migrating VHD to VDI

Post by mpack »

Did you restore the .vbox file to what it was? If not then zip it, post the zip, and we'll check it over.

If the .vbox has not been messed about then the solution is fairly easy.
  1. Make sure the VM is fully closed down as the following will not work with a running or suspended VM.
  2. In the VirtualBox manager go to File|Virtual Media Manager, find your old VHD and "Release" it. This ensures that it is detached from all disk controllers in all registered VMs.
  3. Next, still in the Virtual Media Manager, "Remove" the VHD. This unregisters the VHD, preventing VirtualBox from later complaining about an already-registered UUID.
  4. Now go the settings of the VM, Storage section, highlight the hdd controller and add the VDI as a new attachment to it.
You kind of glossed over how you converted VHD to VDI. How did you do that step?
sterod
Posts: 23
Joined: 30. Apr 2021, 19:08

Re: Migrating VHD to VDI

Post by sterod »

Thank you for this.

I used the Virtual Media Manager with the "copy" command and choose the VDI format.

I was very careful to backup the .vbox file in case I messed it up, but as the changes I made were so small, I just restored it and I have the old VHD back and running. But of course, I now want to migrate to VDI if I can.

What I changed was "J:/C.vhd" format="VHD" to "J:/C.vdi" format "VDI".

Will try your method and will let you know how it goes.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Migrating VHD to VDI

Post by mpack »

sterod wrote: I used the Virtual Media Manager with the "copy" command and choose the VDI format.
Well, be warned that that makes a clone of the VHD rather than an identical replacement, i.e. the clone has a new UUID. That may or may not be relevant, depending on how fussy the guest OS is about this. E.g. Some Linux grub boot scripts can fail because the boot disk can't be found, because the UUID changed. Normally I would convert the VHD using CloneVDI, and I'd set the "Keep UUID" and "Compact" options.
sterod
Posts: 23
Joined: 30. Apr 2021, 19:08

Re: Migrating VHD to VDI

Post by sterod »

OK. Will use that one and do it all over again.
sterod
Posts: 23
Joined: 30. Apr 2021, 19:08

Re: Migrating VHD to VDI

Post by sterod »

Using your utility, and keeping the UUID, everything worked well. Did not need to use the Virtual Media Manager, but simply edit the .vbox file as before. But now, as the UUID was correct, everything worked as a charm!
Not only that, but your compact utility reduced the file size with one third!

Thanks a million.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Migrating VHD to VDI

Post by mpack »

I'm glad you're up and running.
Post Reply