• No results found

VBoxManage import

In document Sun VirtualBox R User Manual (Page 111-115)

This command imports a virtual appliance in OVF format by copying the virtual disk images and creating virtual machines in VirtualBox. See chapter 3.8,Importing and exporting virtual machines, page56for an introduction to appliances.

The import subcommand takes at least the path name of an OVF file as input and expects the disk images, if needed, in the same directory as the OVF file. A lot of additional command-line options are supported to control in detail what is being imported and modify the import paramters, but the details depend on the content of the OVF file.

It is therefore recommended to first run the import subcommand with the --dry-runor -n option. This will then print a description of the appliance’s contents to the screen how it would be imported into VirtualBox, together with the optional command-line options to influence the import behavior.

As an example, here is the screen output with a sample appliance containing a Windows XP guest:

VBoxManage import WindowsXp.ovf --dry-run Interpreting WindowsXp.ovf...

OK.

Virtual system 0:

0: Suggested OS type: "WindowsXP"

(change with "--vsys 0 --ostype <type>"; use "list ostypes" to list all) 1: Suggested VM name "Windows XP Professional_1"

(change with "--vsys 0 --vmname <name>") 3: Number of CPUs (ignored): 1

4: Guest memory: 956 MB (change with "--vsys 0 --memory <MB>") 5: Sound card (appliance expects "ensoniq1371", can change on import)

(disable with "--vsys 0 --unit 5 --ignore") 6: USB controller

(disable with "--vsys 0 --unit 6 --ignore")

7: Network adapter: orig bridged, config 2, extra type=bridged 8: Floppy

(disable with "--vsys 0 --unit 8 --ignore") 9: SCSI controller, type BusLogic

(change with "--vsys 0 --unit 9 --scsitype {BusLogic|LsiLogic}"; disable with "--vsys 0 --unit 9 --ignore")

10: IDE controller, type PIIX4

(disable with "--vsys 0 --unit 10 --ignore") 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")

As you can see, the individual configuration items are numbered, and depending on their type support different command-line options. The import subcommand can be directed to ignore many such items with a --vsys X --unit Y --ignore option, where X is the number of the virtual system (zero unless there are several virtual system descriptions in the appliance) and Y the item number, as printed on the screen. In the above example, Item #1 specifies the name of the target machine in VirtualBox. Items #9 and #10 specify hard disk controllers, respectively. Item #11 describes a hard disk image; in this case, the additional --controller option indi- cates which item the disk image should be connected to, with the default coming from the OVF file.

You can combine several items for the same virtual system behind the same --vsys option. For example, to import a machine as described in the OVF, but without the sound card and without the USB controller, and with the disk image connected to the IDE controller instead of the SCSI controller, use this:

VBoxManage import WindowsXp.ovf

--vsys 0 --unit 5 --ignore --unit 6 --ignore --unit 11 --controller 10

8.7 VBoxManage export

This command exports one or more virtual machines from VirtualBox into a virtual appliance in OVF format, including copying their virtual disk images to compressed

VMDK. See chapter3.8,Importing and exporting virtual machines, page56for an in- troduction to appliances.

The export command is simple to use: list the machine (or the machines) that you would like to export to the same OVF file and specify the target OVF file after an additional --output or -o option. Note that the directory of the target OVF file will also receive the exported disk images in the compressed VMDK format (regardless of the original format) and should have enough disk space left for them.

Beside a simple export of a given virtual machine, you can append several prod- uct information to the appliance file. Use --product, --producturl, --vendor, --vendorurland --version to specify this additional information. For legal rea- sons you may add a license text or the content of a license file by using the --eula and --eulafile option respectively. As with OVF import, you must use the --vsys Xoption to direct the previously mentioned options to the correct virtual machine.

For virtualization products which aren’t fully compatible with the OVF standard 1.0 you can enable a OVF 0.9 legacy mode with the --legacy09 option.

8.8 VBoxManage startvm

This command starts a virtual machine that is currently in the “Powered off” or “Saved” states.

Note: This is provided for backwards compatibility only. We recommend to

start virtual machines directly by running the respective front-end, as you might otherwise miss important error and state information that VirtualBox may display on the console. This is especially important for front-ends other than VirtualBox, our graphical user interface, because those cannot display error messages in a popup window. See chapter 7.4.1, VBoxHeadless, the VRDP-only server, page94for more information.

The optional --type specifier determines whether the machine will be started in a window (GUI mode, which is the default) or whether the output should go through VBoxHeadless, with VRDP enabled or not; see chapter 7.4.1, VBoxHeadless, the VRDP-only server, page94for more information. The list of types is subject to change, and it’s not guaranteed that all types are accepted by any product variant.

The following values are allowed:

gui Starts a VM showing a GUI window. This is the default.

vrdp Starts a VM showing a GUI window, with its graphics card output accessible by an RDP client.

8.9 VBoxManage controlvm

The controlvm subcommand allows you to change the state of a virtual machine that is currently running. The following can be specified:

• VBoxManage controlvm <vm> pause temporarily puts a virtual machine on hold, without changing its state for good. The VM window will be painted in gray to indicate that the VM is currently paused. (This is equivalent to selecting the “Pause” item in the “Machine” menu of the GUI.)

• Use VBoxManage controlvm <vm> resume to undo a previous pause com- mand. (This is equivalent to selecting the “Resume” item in the “Machine” menu of the GUI.)

• VBoxManage controlvm <vm> reset has the same effect on a virtual ma- chine as pressing the “Reset” button on a real computer: a cold reboot of the virtual machine, which will restart and boot the guest operating system again immediately. The state of the VM is not saved beforehand, and data may be lost. (This is equivalent to selecting the “Reset” item in the “Machine” menu of the GUI.)

• VBoxManage controlvm <vm> poweroff has the same effect on a virtual machine as pulling the power cable on a real computer. Again, the state of the VM is not saved beforehand, and data may be lost. (This is equivalent to selecting the “Close” item in the “Machine” menu of the GUI or pressing the window’s close button, and then selecting “Power off the machine” in the dialog.)

After this, the VM’s state will be “Powered off”. From there, it can be started again; see chapter8.8,VBoxManage startvm, page113.

• VBoxManage controlvm <vm> savestate will save the current state of the VM to disk and then stop the VM. (This is equivalent to selecting the “Close” item in the “Machine” menu of the GUI or pressing the window’s close button, and then selecting “Save the machine state” in the dialog.)

After this, the VM’s state will be “Saved”. From there, it can be started again; see chapter8.8,VBoxManage startvm, page113.

A few extra options are available with controlvm that do not directly affect the VM’s running state:

• The setlinkstate<1-4> operation connects or disconnects virtual network cables from their network interfaces.

• usbattach and usbdettach make host USB devices visible to the virtual ma- chine on the fly, without the need for creating filters first. The USB devices can be specified by UUID (unique identifier) or by address on the host system. You can use VBoxManage list usbhost to locate this information.

• dvdattach inserts a DVD image into the virtual machine or connects it to the host DVD drive. With this command (as opposed to VBoxManage modifyvm), the image file does not first have to be registered with VirtualBox.

You can use VBoxManage list hostdvds to display all the drives found on the host and the names VirtualBox uses to access them.

• floppyattach works in a similar way.

• setvideomodehint requests that the guest system change to a particular video mode. This requires that the guest additions be installed, and will not work for all guest systems.

• The setcredentials operation is used for remote logons in Windows guests. For details, please refer to chapter 9.2, Automated Windows guest logons (VBoxGINA), page127.

8.10 VBoxManage discardstate

This command discards the saved state of a virtual machine which is not currently running, which will cause its operating system to restart next time you start it. This is the equivalent of pulling out the power cable on a physical machine, and should be avoided if possible.

8.11 VBoxManage snapshot

This command is used for taking snapshots of a virtual machine and for manipulating and discarding snapshots.

The take operation takes a snapshot of a virtual machine. You must supply a name for the snapshot and can optionally supply a description.

The discard operation discards a snapshot specified by name or by identifier (UUID).

The discardcurrent operation will either revert the current state to the most recent snapshot (if you specify the --state option) or discard the last snapshot and revert to the last but one (with the --all option).

In document Sun VirtualBox R User Manual (Page 111-115)