No Way to Import VDI?

This is for discussing general topics about how to use VirtualBox.
Post Reply
jdw13
Posts: 4
Joined: 19. Oct 2007, 00:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WinXP, Win2003

No Way to Import VDI?

Post by jdw13 »

I'm using VB 4.0.12 on a Win7 x64 host. My VMs were all created in VB v3 or earlier, and are specified by XML files.

I recently tried to move my VMs to a different disk, and made the mistake of removing my VDIs from the Virtual Media Manager without noticing that there is no Add button to add them back from their new location. (Yes, I now know there are easier ways to move VMs..)

I was then left with my VMs intact, but not usable in VB because there is no (obvious) way to import an existing VDI into VB. And I couldn't add my existing VMs back into VB either; when I tried this I got an error
Failed to open virtual machine located in {XML path}
Could not find an open hard disk with UUID {uuid}
Eventually I found that in creating a new (temporary) VM I was given the option to use an existing VDI, which would add the VDI to the Virtual Media Manager. I could then remove the temp VM from VB and Add back the existing VM, since the VDI now existed.

This worked, but why can't VDI's be added directly to the Virtual Media Manager? Or why can't they be added when an existing VM is added back to VB?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: No Way to Import VDI?

Post by Perryg »

The new format is when you want to install an original VDI (no snapshots) to a new VirtualBox host, you create a new guest and when asked if you want to create a new HDD or use an existing one you select to use an existing one and attach it there.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: No Way to Import VDI?

Post by mpack »

jdw13 wrote:I recently tried to move my VMs to a different disk, and made the mistake of removing my VDIs from the Virtual Media Manager without noticing that there is no Add button to add them back from their new location. (Yes, I now know there are easier ways to move VMs..)
If I understand you correctly, then you tried to move your VDIs (not your VMs) to a different drive. You started by releasing and removing the drive from the global media manager. To add it back you do so from the "Storage" section of the VM settings: a little icon beside the IDE or SATA controller is there to let you add new HDDs.
jdw13 wrote:Eventually I found that in creating a new (temporary) VM I was given the option to use an existing VDI, which would add the VDI to the Virtual Media Manager. I could then remove the temp VM from VB and Add back the existing VM, since the VDI now existed.
Don't do that. That means that you're using the mechanism intended to allow drives to be shared between VMs - your original VM is accessing the drive, but another VM owns it, and the other VM no longer exists. This is exactly the kind of unexpected setup that can leave you prone to bugs. Release the drive again, then use the mechanism described above to locally add the drive to the correct VM.
jdw13 wrote:This worked, but why can't VDI's be added directly to the Virtual Media Manager? Or why can't they be added when an existing VM is added back to VB?
v4 deprecates the concept of a global media registry, which is why it fights you when you continue to try to use it. A global media registry is a poor design feature from an "all eggs in one basket" point of view. One little zap to VirtualBox.xml, and all your VMs are gone, and if you used snapshots then that situation was often not recoverable. Even backups are hard to restore when it has to be reintegrated into a global media registry. In v4 each VM now has its own local media registry, that's why drives are added locally, and that's also why it's a bad idea to add a drive locally in VM-B when your true goal is to access it from VM-A. Backups and restores are now easy enough even for novices.

Incidentally: you should say whether you are using snapshots or not, it makes a big difference.
jdw13
Posts: 4
Joined: 19. Oct 2007, 00:02
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WinXP, Win2003

Re: No Way to Import VDI?

Post by jdw13 »

Thanks for the detailed reply. I now see the real problem here: While v4 has a new storage scheme, it doesn't automatically convert pre-v4 VMs to the new scheme. And my pre-v4 VMs still expect to use the old system.
mpack wrote:If I understand you correctly, then you tried to move your VDIs (not your VMs) to a different drive...
Actually, I wanted to move my entire VM tree, and I made the mistake of just doing it. I copied the VM tree to the new location and renamed the original tree, thinking I'd be prompted by VBox to point it to the new location for each VM and VDI. Instead, when I started VBox it showed all the VMs and VDIs as inaccessible. I closed VBox and restored the original location, but VBox still showed everything as inaccessible. The XML files for the VMs were now found, but the VDIs were no longer in the VMM, and there was no way to add them back. I had no way to undo my mistake.
mpack wrote:...You started by releasing and removing the drive from the global media manager. To add it back you do so from the "Storage" section of the VM settings: a little icon beside the IDE or SATA controller is there to let you add new HDDs.
Not with pre-v4 VMs, anyway. While a VM is "inaccessible" it's not possible to access its settings. And without the VDI in the VMM, the VM remains "inaccessible". No way back...

I later tried removing the VMs and adding them back in. But, again, the VMs couldn't be added back to VBox without already having their VDIs in the VMM (the error is "could not find an open hard disk with UUID...") and v4 provides no way to do that. Again, the pre-v4 VMs are expecting me to use the global media registry, which v4 doesn't really provide.
mpack wrote:
jdw13 wrote:Eventually I found that in creating a new (temporary) VM I was given the option to use an existing VDI, which would add the VDI to the Virtual Media Manager. I could then remove the temp VM from VB and Add back the existing VM, since the VDI now existed.
Don't do that...
This may not have been ideal, but it was either this or lose all my pre-v4 VMs.
mpack wrote:v4 deprecates the concept of a global media registry, which is why it fights you when you continue to try to use it...
That's fine, but then VBox should have made this much more clear when I upgraded from v3 to v4, and explained why I should upgrade my VMs to v4 (which I've now done). I had no idea this issue existed, or the problems it could cause.
mpack wrote:Incidentally: you should say whether you are using snapshots or not, it makes a big difference.
Fortunately (I think), no.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: No Way to Import VDI?

Post by mpack »

jdw13 wrote:Thanks for the detailed reply. I now see the real problem here: While v4 has a new storage scheme, it doesn't automatically convert pre-v4 VMs to the new scheme. And my pre-v4 VMs still expect to use the old system.
That's true, no automatic conversion. But it does have backwards support for the old global registry, so upgrading alone would not have hosed your system - and did not.
jdw13 wrote:
mpack wrote:...You started by releasing and removing the drive from the global media manager. To add it back you do so from the "Storage" section of the VM settings: a little icon beside the IDE or SATA controller is there to let you add new HDDs.
Not with pre-v4 VMs, anyway.
Yes, with pre-v4 VMs too, if they run in v4 VirtualBox. You already saw that you don't have a global hdd add button.
jdw13 wrote:While a VM is "inaccessible" it's not possible to access its settings. And without the VDI in the VMM, the VM remains "inaccessible".
Yes, deleting the xmls from where VBox expects to find them will do that. (FYI: the Machines path default in preferences doesn't apply to VMs that already exist, that path is where new VMs will go). The practical difficulty of moving existing xmls (v3 style anyway) is why I initially assumed you hadn't attempted it.

Obviously you need to fix the VM list first. Probably the easiest thing is just to delete them all, and create new VMs. However when you get to the hard disk creation step select "Use existing" and browse to your existing VDI, which you should previously have moved to its preferred location. Try to get the VM recipes as close as possible, perhaps even having the old xml visible in a text editor for reference (i.e. preserve IO APIC setting, hard disk controller type and MAC address). It's pot luck whether Windows VMs still see enough changes to need reactivation.
king_ramen
Posts: 7
Joined: 14. Oct 2011, 01:15
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: ubuntu

Re: No Way to Import VDI?

Post by king_ramen »

I can't select "Use an Existing Disk" without that being in the Registry. There is no way to add a file from the filesystem to the registry???
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: No Way to Import VDI?

Post by Perryg »

king_ramen wrote:I can't select "Use an Existing Disk" without that being in the Registry. There is no way to add a file from the filesystem to the registry???
I know you are frustrated but stick to one post please. I am trying to work with you on your other one to resolve this and some other issues you are having.
froghunter
Posts: 5
Joined: 10. May 2008, 16:21

Re: No Way to Import VDI?

Post by froghunter »

Is there any way to move your 'recipe' around (export or copy)? I am working on moving a single virtual machine onto 3 separate computers and currently I am copying the VDI, then creating a new machine, praying I don't change any settings in the process.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: No Way to Import VDI?

Post by mpack »

If the VM was created by VirtualBox v4.x then you can copy the VM folder to a new host and select Machine|Add to add the VM to the UI on that host. Thereafter if you want to keep the different PCs synched you just copy the VDI, not the entire VM (alternatively you would have to remove the VM from the UI before overwriting and adding back a new version of it).

Moving VMs between different host OS's may be problematic, depending on what OS resources the .vbox references (e.g. "COM1" and host CD drive "F:" only exists on Windows). OTOH a few minor manual edits should be enough to fix anything like that.
froghunter
Posts: 5
Joined: 10. May 2008, 16:21

Re: No Way to Import VDI?

Post by froghunter »

Perfect. I think I got confused reading post mentioning the now deprecated xml files. This shouldn't be too hard since all the host are the same.
Post Reply