Create Config File for a VMDK or VDI disk

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
JRSAF
Posts: 17
Joined: 12. Jan 2017, 18:14

Create Config File for a VMDK or VDI disk

Post by JRSAF »

Hello,

I have a both a VDI and VMDK image disks. I placed the disks in two separate folders under the default Virtual Box location. HOwever, when i try to add the vmdk, it complaints about the folder already existing, but i realize i need the config file so i can add the VM to virtual box.

My question is, since all i have is the vmdk and the vdi files, how can I create the config file for each VM (using command line) so i can add them to virtual box and start using them again. Please advice. thanks.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Create Config File for a VMDK or VDI disk

Post by socratis »

Please answer all the questions below:
  1. Are these two images (VDI and VMDK) from an OSX guest? What's your host?
  2. Can I ask where/how you got those two files? Did you convert one format to the other?
  3. You say you created two folders manually and you added the VDI to one and the VMDK to the other, correct? Names? Full names of both the folders (full path please) and the VDI & VMDK (just the filenames).
  4. You want to create a VM from the command line and then add the virtual hard disks to the VM, right? There might be a conflict there with the names, that's why it is essential to have the full names. And the full name of the VM that you want to create.
  5. Please post the commands that you used and the error messages that you received.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
JRSAF
Posts: 17
Joined: 12. Jan 2017, 18:14

Re: Create Config File for a VMDK or VDI disk

Post by JRSAF »

These were old VDI and VMDK files from a previous virtual box i was using. But when i backed them up, it looks like a previous version of virtual box kept the config files and disk images in separate folders. After upgrading machine, that was lost and were not kept in the same directory.

/VM/vm1/vm1.vmdk
/VM/vm2/vm2.vdi

The error was from within virtual box stating that it could not create the vm1 and vm2 since those already exist.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Create Config File for a VMDK or VDI disk

Post by socratis »

I remember posting the following:
socratis wrote:Please answer all the questions below:
You didn't answer not even half of my original questions. Please try again:
  1. No answer.
  2. 1/2 answer. Did you convert one format to the other? Do you remember the VirtualBox version?
  3. 1/2 answer. So, the folders were already created from a backup. Correct? Is the full path "/VM/vm1/vm1.vmdk" and "/VM/vm2/vm2.vdi"? That's a really unusual full path to have the VMs in. Please explain. Do you have a folder "/VM" in your root folder???
  4. No answer.
  5. No answer.
If you want me to continue this conversation, please answer completely all the questions. I don't want to be going back and forth with half messages. It doesn't help...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
JRSAF
Posts: 17
Joined: 12. Jan 2017, 18:14

Re: Create Config File for a VMDK or VDI disk

Post by JRSAF »

1) Are these two images (VDI and VMDK) from an OSX guest? What's your host?
They are from a virtual box. Running on OSX

2) no conversion.

3) correct, i have a root folder called VM as i changed the default location of virtual box

4) add VM using GUI options: either 'Add' or 'New'. However the VMs need the config file which was lost after upgrading

5) i did not run commands on the command line. I was only trying to add the disks using the GUI.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Create Config File for a VMDK or VDI disk

Post by socratis »

JRSAF wrote:They are from a virtual box.
I would never have guessed. Thank for clearing that up.
JRSAF wrote:Running on OSX
So, this is not a "OS X Guest" issue, it's a "OS X Host" issue. I'll move it.
JRSAF wrote:i have a root folder called VM
Wow... Any particular reason? The logic behind that decision?


OK, I think I have enough evidence to guess what's going on. I'll use one VM as an example, it's the same logic for both of them:
  • When you use the "Wizard" to create a new VM, VirtualBox creates the path from the "Default Folder" plus the name of the VM. So, if your default folder is "/Users/<user>/VirtualBox VMs" and your VM's name is "vm1", then VirtualBox tries to create the folder "/Users/<user>/VirtualBox VMs/vm1".
  • If that folder already exists, VirtualBox tries to warn you so you don't overwrite files that you shouldn't. In fact it refuses to create the folder at all. That's a "Good thing™".
  • What you need to do is to move the VDI and the VMDK somewhere else, then delete the "/VM/vm1" and "/VM/vm2" directories.
  • Create "vm1" in Guided mode, not in Expert mode.
  • As soon as you go to step 2 (memory allocation) VirtualBox will create the folder "/VM/vm1".
  • Switch to the Finder/Terminal and move the "vm1.vmdk" file to the "/VM/vm1" folder.
  • Switch back to the VirtualBox wizard. After you select the memory, in step 3 you're asked about the hard drive. Choose "Use an existing virtual hard disk", click on the folder icon and select "/VM/vm1/vm1.vmdk".
  • Repeat for the other VM.
  • Done.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
JRSAF
Posts: 17
Joined: 12. Jan 2017, 18:14

Re: Create Config File for a VMDK or VDI disk

Post by JRSAF »

let me try this.. this looks like it may work.
Post Reply