Page 1 of 2
Can't import appliance as VDI
Posted: 28. Feb 2012, 18:05
by joeller
Hi guys
We are just getting started on VirtualBox. We saved our first Virtual Machine by exporting an appliance. Then we messed up our Virtual machine and so we imported that appliance that we just exported. But when it cam back in, instead of being a VDI, it was a vmdk file. What happened to our VDI? How can we import our exported appliance as a VDI.
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 18:27
by mpack
Export/Import uses a portable VM specification developed by VMWare: naturally they used VMDK as the disk medium.
IMHO, the export/import feature is now largely redundant (*). Just copy the VM folder (for backup purposes), or use the clone feature of the GUI (if the purpose of copying is to have multiple versions of one VM on the same host).
(*) Unless you desperately need to move VMs between VBox and VMWare.
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 18:59
by joeller
So you are saying the only thing we need for backup purposes is a copy of the VM folder stored somewhere and when you need to do a restore just replace the current folder with the backed up folder? Presumably this will lose all snapshots and what not and restore the folder to where it was at the time the copy was made. is that correct?
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 19:22
by mpack
joeller wrote:So you are saying the only thing we need for backup purposes is a copy of the VM folder stored somewhere and when you need to do a restore just replace the current folder with the backed up folder?
Correct.
joeller wrote:Presumably this will lose all snapshots and what not and restore the folder to where it was at the time the copy was made. is that correct?
As always, anything not included in a backup is lost after a restore.
The only caveat is the VM must have been created using VirtualBox v4.0.0 or later (prior to that, VM files did not all go in one folder). If you are just starting out with VBox then this will be no problem for you. Long standing users have had to convert the VM layout to v4 to get the same benefit.
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 19:29
by joeller
But will that work for copying virtual machines between Virtual Box on two different machines? Seems to me that you would have to go through the create VM process and select the copied disk image as the new virtual hard drive. Would this create any problems? Or should one use the export import process for this. If so I would be interesting in finding a way to export a owa with a vdi instead of a vmdk.
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 19:49
by mpack
joeller wrote:But will that work for copying virtual machines between Virtual Box on two different machines?
Yes, that will work. You must use
Machine|Add... to add a VM to the dest manager for the first time. Thereafter you just copy the folder contents, or just copy the VDI (provided you avoid snapshots, which you are recommended to do anyway).
The only problems when moving between hosts are obvious ones: the settings will have to be edited if they refer to resources that don't exist on the second host (e.g. a shared folder name). Also if the new host is very different then Windows guests may need to be reactivated (things like e.g. CPU type are visible to the guest).
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 20:17
by joeller
OK. Kool.
However, my customer still wants to know how to export a VDI instead of a VMDK.
So if anyone has any info on that it would be welcome.
Re: Can't import appliance as VDI
Posted: 28. Feb 2012, 20:29
by Perryg
You don't export a guest in VDI format. It must be in the form of vmdk. You can convert it back to a VDI using VBoxManage or
CloneVDI Tool.
Re: Can't import appliance as VDI
Posted: 3. May 2012, 15:56
by joeller
Hi MPAck, if you are still monitoring this thread. Or anyone else who happens to see this.
I would like to take one of my backup folders of the exisiting and restore it as a new Virtual Machine that is a copy of the existing virtual machine at a previous state.
I am assuming I can copy the backuped folder with a different name. But what about the Vbox files and the vdi files which are also named after the other Virtual machine? Do I just rename them as well?
I read in other articles that restoring clones to the same machine in previous versions of VirtualBox could be a problem due to the non-unique UUID. Will this be an issue? How can I carry this out with the minimum of issues?
p.s. I do not know how to given people credit for questions answered on this forum. Also I did not know which Virtual box version to show in my profile. I am using Oracle VirtualBox 4.1.8 r75467
Re: Can't import appliance as VDI
Posted: 3. May 2012, 16:19
by mpack
The folder name is not particularly relevant. There are however VM and disk UUIDs which will conflict with the existing (newer state) VM.
If it was me I would :-
- Copy your backup VM folder to a convenient accessible temp folder. This will not be the final VM location.
- Run the GUI and remove (but not physically delete!) the existing VM (don't worry, you'll add this back later).
- Shut down VBox and leave it shut down for 1 minute (needed to be sure it forgets the conflicting VM).
- Restart the GUI and use Machine|Add... to add your old VM to the GUI.
- Right click the VM and select "Clone". Make a complete (not linked) clone of the current state.
- Delete the original of the VM you just cloned. This time do choose to physically delete files.
- Shut down VBox and wait another minute.
- Restart the GUI and use Machine|Add... to restore the VM you removed in step 2.
It takes longer to describe than to do.
Re: Can't import appliance as VDI
Posted: 3. May 2012, 16:23
by mpack
Another way which may be faster is to rename (or copy elsewhere) the VirtualBox.xml to something else before running VBox. That should force VBox to create a new (blank) VM list next time it runs, to which you add and then clone your backup VM. Shut down, rename the original VirtualBox.xml file, run, and use Machine|Add to add the clone VM you made.
Re: Can't import appliance as VDI
Posted: 3. May 2012, 16:33
by joeller
While this is copying let me address a couple of concerns.
When I add the older copy of the VM back as a VM, will it not overwrite the under Program Files\VirtualBox\ folder with the current copy and the current snapshots and state? Thereby losing all of the changes which have taken place since we made the backup?
When I remove the older copy of the VM with physical delete, will it not delete the folder under Program Files\Virtual Box that contains the version of VM that is on the machine?
Re: Can't import appliance as VDI
Posted: 3. May 2012, 16:48
by joeller
I tried moving the current vM folder then adding a new vm with the copy of the backup folder. What I got was the following error
Failed to open virtual machine located in C:/_D/_Junk/CPVFS_SQL_2003-64/CPVFS_SQL_2003-64.vbox.
Cannot register the hard disk 'C:\_D\_Junk\CPVFS_SQL_2003-64\CPVFS_SQL_2003-64.vdi' {82b62480-8c1d-4e68-82bd-9e69e1b95c5d} because a hard disk 'C:\_Program_Files_VFS\VirtualBox\CPVFS_SQL_2003-64\CPVFS_SQL_2003-64.vdi' with UUID {82b62480-8c1d-4e68-82bd-9e69e1b95c5d} already exists.
Result Code: E_INVALIDARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}
Please advise.
Re: Can't import appliance as VDI
Posted: 3. May 2012, 16:53
by mpack
I don't see any connection between what you tried and the careful step by step instructions I gave.
Re: Can't import appliance as VDI
Posted: 3. May 2012, 17:12
by joeller
1.Copy your backup VM folder to a convenient accessible temp folder. This will not be the final VM location.
Copied backed up VM folder to D\_Junk directory
2.Run the GUI and remove (but not physically delete!) the existing VM (don't worry, you'll add this back later).
Did this.
3.Shut down VBox and leave it shut down for 1 minute (needed to be sure it forgets the conflicting VM).
Did this. copied Virtualbox.xml file to different directory.
Then because of concerns about overwriting the real and correct "CPVFS_SQL_2003-64" VM I moved that folder to a different location since I could not copy it due to a lack of disk space.
4.Restart the GUI and use Machine|Add... to add your old VM to the GUI.
Did this. The first attempt produce the message provide in the previous post. Then closed VBox again, and let it sit for 3 minutes. and reattempted add. This time add proceeded.
5.Right click the VM and select "Clone". Make a complete (not linked) clone of the current state.
Did this. Chose to only create current state since I had no need for previous snapshots. However attempt to clone errored out with "inability to find" a particular file. I copied that error message into the clipboard, but then failed to paste it before doing another copy. Rationalized that this may be due to the fact that I never turned the newly added backup VM on. So I attempted to start the VM. This produced the error below (which was copied into clipboard).
Failed to open a session for the virtual machine CPVFS_SQL_2003-64.
No error info.
Result Code: E_FAIL (0x80004005)
Component: ProgressProxy
Interface: IProgress {c20238e4-3221-4d3f-8891-81ce92d9f913}
Removed backup VM and deleted files.
Moved real VM CPVFS_SQL_2003-64 folder back under the Program Files\Virtual Box Folder. Moved original VirtualBox.xml file back to proper location. Re-added Real VM. started VM. Worked fine.