Import Appliance Target Path

This is for discussing general topics about how to use VirtualBox.
Post Reply
flatlander
Posts: 5
Joined: 11. Aug 2010, 17:07
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows and Linux

Import Appliance Target Path

Post by flatlander »

Hello All,

I have created a virtual machine. I then exported it as an appliance. Now I would like to import the appliance but I want to have the hard disk file saved in a specific directory. So far I have tried:

1. Importing through the GUI and editing the hd location, but after the import was done it is in the default location.

2. Tried VBoxManage but I can not find a parameter for import that will allow me to specify where to put the vmdk.

My host is an OSX machine and it always wants to put it in /Users/<username>/Library/VirtualBox/HardDisks.

Which in my case in an nfs mount and I do not want all of my users putting VM's in their NFS-homes.

Ideas / Suggestions?

Thanks
TIA
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Import Appliance Target Path

Post by Perryg »

See Chapter 1.11. Importing and exporting virtual machines and Chapter 8.8. VBoxManage import in your VirtualBox users guide.
Just change the location of the Hard Disk Image.

Code: Select all

11: Hard disk image: source image=WindowsXp.vmdk,
      target path=/home/user/disks/WindowsXp.vmdk, controller=9;channel=0
    (change controller with "--vsys 0 --unit 11 --controller <id>";
    disable with "--vsys 0 --unit 11 --ignore")
flatlander
Posts: 5
Joined: 11. Aug 2010, 17:07
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows and Linux

Re: Import Appliance Target Path

Post by flatlander »

Perryg wrote:See Chapter 1.11. Importing and exporting virtual machines and Chapter 8.8. VBoxManage import in your VirtualBox users guide.
Just change the location of the Hard Disk Image.

Code: Select all

11: Hard disk image: source image=WindowsXp.vmdk,
      target path=/home/user/disks/WindowsXp.vmdk, controller=9;channel=0
    (change controller with "--vsys 0 --unit 11 --controller <id>";
    disable with "--vsys 0 --unit 11 --ignore")
I have not been able to figure out the command to do it. From what I can tell I can only change the controller id??

Thanks
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Import Appliance Target Path

Post by Perryg »

If you use the GUI to import you just need to double click on the file location and put the full path to where you want it to be install.
Attachments
Import.jpg
Import.jpg (115.31 KiB) Viewed 11259 times
flatlander
Posts: 5
Joined: 11. Aug 2010, 17:07
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows and Linux

Re: Import Appliance Target Path

Post by flatlander »

Perryg wrote:If you use the GUI to import you just need to double click on the file location and put the full path to where you want it to be install.
Man I will try it again. I thought I did that but it still copied to ~/Library/Virt.... directory.

I will try again.

Thanks
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Import Appliance Target Path

Post by Perryg »

Here I am importing from a shared drive to an external drive on Linux host. Just remember that you must use the full path.
Attachments
Import-Linux.jpg
Import-Linux.jpg (72.95 KiB) Viewed 11249 times
flatlander
Posts: 5
Joined: 11. Aug 2010, 17:07
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows and Linux

Re: Import Appliance Target Path

Post by flatlander »

flatlander wrote:
Perryg wrote:If you use the GUI to import you just need to double click on the file location and put the full path to where you want it to be install.
Man I will try it again. I thought I did that but it still copied to ~/Library/Virt.... directory.

I will try again.

Thanks
Tried again and when I double click on the box with the target path it let's me edit it. Then I click out and start the import, but it still is writing the file to the ~/Library/Virtual.....

Maybe this is OSX specific?

Anyone know who to make it work with VBoxManage? I really need to script this whole process.
flatlander
Posts: 5
Joined: 11. Aug 2010, 17:07
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows and Linux

Re: Import Appliance Target Path

Post by flatlander »

flatlander wrote:
flatlander wrote:
Perryg wrote:If you use the GUI to import you just need to double click on the file location and put the full path to where you want it to be install.
Man I will try it again. I thought I did that but it still copied to ~/Library/Virt.... directory.

I will try again.

Thanks
Tried again and when I double click on the box with the target path it let's me edit it. Then I click out and start the import, but it still is writing the file to the ~/Library/Virtual.....

Maybe this is OSX specific?

Anyone know who to make it work with VBoxManage? I really need to script this whole process.
Bump. Bump.
uppe
Posts: 2
Joined: 5. Nov 2010, 10:35
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: Import Appliance Target Path

Post by uppe »

Re-bump.
uppe
Posts: 2
Joined: 5. Nov 2010, 10:35
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: Import Appliance Target Path

Post by uppe »

Setting the environment variable VBOX_USER_HOME let me change the target path.

Just prefix the VBoxManage command with for example VBOX_USER_HOME=/var/virtualbox
randyjames
Posts: 9
Joined: 30. Dec 2008, 01:51

Re: Import Appliance Target Path

Post by randyjames »

There seems to be some resistance to answering the original question: "How do you change the target path using VBoxManage?"

Here's the "documentation" for item 11:
11: Hard disk image: source image=WindowsXp.vmdk,
target path=/home/user/disks/WindowsXp.vmdk, controller=9;channel=0
(change controller with "--vsys 0 --unit 11 --controller <id>";
disable with "--vsys 0 --unit 11 --ignore")
I presume the first part goes something like this:

--vsys 0 --unit 11

After that, who knows? In the example above, the 'path' appears to point to a file, so it might be any of:

--path /usr/local/myvboxhome/<vdkfilename>
--path=/usr/local/myvboxhome/<vdkfilename>
--target /usr/local/myvboxhome/<vdkfilename>
--target path=/usr/local/myvboxhome/<vdkfilename>
--target-path=/usr/local/myvboxhome/<vdkfilename>

I even read one comment somewhere that said it was none of the above, and that the parameter was actually:

--disk /usr/local/myvboxhome
(with just the path, not the destination filename)

When the person asking for help says something like "I really need to script this...", why try to re-direct him or her to GUI, or an environment parameter? If there is no way to do a command line import and define a new "--target path", that would be helpful to know. Better, a specific example of how to set the target path using the CLI "import" command. Best: including the syntax in the reference manual rather than:
[more options]
(run with -n to have options displayed for a particular OVF)
If anyone knows what goes after the --vsys 0 --unit 11 portion of the command line that sets the destination directory path, it would certainly be helpful to see a simple example. It would also be helpful to know if the path reference refers to a directory, or the actual name of the file.

Thanks in advance.

(Thanks in advance.)
rgoers
Posts: 5
Joined: 27. Feb 2013, 16:23

Re: Import Appliance Target Path

Post by rgoers »

This may be a little late in coming... but I was searching for the same info and had to stumble upon the answer by experimenting on my own. The help is very confusing when it comes to setting the target path. Here's what I found actually works:
--vsys 0 -- unit 10 --disk <path/fn>

for example:
--vsys 0 --unit 10 --disk /mnt/scratch/import_test.vmdk
will place the new VM (import_test.vmdk) in your local machine's "/mnt/scratch" directory.

The entire command might look like this:
VBoxManage import ~/subdir1/subdir2/win7_vm/exported_vm.ova --vsys 0 --unit 11 --disk /mnt/scratch/import_test.vmdk

Hope that helps someone... maybe the help documentation could be re-written to be more consistent with the rest of the conventions used in VBoxManage (i.e. "--memory <MB>", and "--vname <name>", etc.). If help displayed "--disk <path/fn>" instead of "--disk path", it would be much easier to understand how to set the target path.

One more note: The (above) will import the machine into the account you are logged into - so if you're root when you import, it will go into root's VB GUI - if you're logged into your user account, it will go into your user account VB GUI.
Post Reply