Tag Archives: VirtualBox

Some VirtualBox Commands

VBoxManage Commands

By default, the VBoxManage command (VBoxManage.exe) on Windows is located in the C:Program FilesOracleVirtualBox directory. You need to change to this directory or place this directory in the PATH environment variable.

1. To list all existing virtual hard drives:

VBoxManage list hdds

For example:

UUID:        1817c1f6-6888-4105-b46d-e3135a99cfcb
Parent UUID: base
Format:      VDI
Location:    C:VasudevVirtualBoxWindows XPWindows XP.vdi
State:       inaccessible
Type:        normal

UUID:        260bd00a-d35e-47b5-8c4d-1821ec008818
Parent UUID: 1817c1f6-6888-4105-b46d-e3135a99cfcb
Format:      VDI
Location:    E:VirtualBoxWindows XPSnapshots/{260bd00a-d35e-47b5-8c4d-1821ec0
08818}.vdi
State:       created
Type:        normal

UUID:        712e180b-bbf0-4d0d-ac64-81d545a5669e
Parent UUID: 1817c1f6-6888-4105-b46d-e3135a99cfcb
Format:      VDI
Location:    E:VirtualBoxWindows XPSnapshots/{712e180b-bbf0-4d0d-ac64-81d545a
5669e}.vdi
State:       created
Type:        normal

2. To remove an existing or inaccessible virtual hard drive:

VBoxManage closemedium      disk|dvd|floppy <uuid>|<filename>
                            [--delete]

For example:

C:Program FilesOracleVirtualBox>VBoxManage.exe closemedium disk 1817c1f6-6888
-4105-b46d-e3135a99cfcb
VBoxManage.exe: error: Cannot close medium 'C:VasudevVirtualBoxWindows XPWin
dows XP.vdi' because it has 2 child media
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), componen
t Medium, interface IMedium, callee IUnknown
Context: "Close()" at line 1186 of file VBoxManageDisk.cpp

C:Program FilesOracleVirtualBox>VBoxManage.exe closemedium disk 260bd00a-d35e
-47b5-8c4d-1821ec008818

C:Program FilesOracleVirtualBox>VBoxManage.exe closemedium disk 712e180b-bbf0
-4d0d-ac64-81d545a5669e

C:Program FilesOracleVirtualBox>VBoxManage.exe closemedium disk 1817c1f6-6888
-4105-b46d-e3135a99cfcb

C:Program FilesOracleVirtualBox>

3. To start a virtual machine without a console (i.e. ‘headless’):

VBoxManage startvm          <uuid>|<name>...
                            [--type gui|sdl|headless]

dsfdfs

4. After manually copying a VirtualBox hard drive in Windows Explorer and adding it to a newly created VM in the VirtualBox GUI, the following error appears:

Failed to open the hard disk J:VirtualBoxPatch11iPatch11i1.vdi.
Cannot register the hard disk 'J:VirtualBoxPatch11iPatch11i1.vdi' 
{d2696d49-07c6-46bd-9e31-84b4c5fa649b} because a hard disk 
'I:VirtualBoxOEL5VIS4BIOEL5VIS4I1.vdi' with UUID 
{d2696d49-07c6-46bd-9e31-84b4c5fa649b} already exists.
Result Code: E_INVALIDARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}

Use the internalcommands parameter with VBoxManage.exe to set a change the hard drive’s UUID:

C:Program FilesOracleVirtualBox>VBoxManage.exe internalcommands
Oracle VM VirtualBox Command Line Management Interface Version 4.1.16
(C) 2005-2012 Oracle Corporation
All rights reserved.

Usage: VBoxManage internalcommands <command> [command arguments]

Commands:

  loadsyms <vmname>|<uuid> <symfile> [delta] [module] [module address]
      This will instruct DBGF to load the given symbolfile
      during initialization.

  unloadsyms <vmname>|<uuid> <symfile>
      Removes <symfile> from the list of symbol files that
      should be loaded during DBF initialization.

  sethduuid <filepath> [<uuid>]
       Assigns a new UUID to the given image file. This way, multiple copies
       of a container can be registered.

  sethdparentuuid <filepath> <uuid>
       Assigns a new parent UUID to the given image file.

  dumphdinfo <filepath>
       Prints information about the image at the given location.

  listpartitions -rawdisk <diskname>
       Lists all partitions on <diskname>.

  createrawvmdk -filename <filename> -rawdisk <diskname>
                [-partitions <list of partition numbers> [-mbr <filename>] ]
                [-relative]
       Creates a new VMDK image which gives access to an entite host disk (if
       the parameter -partitions is not specified) or some partitions of a
       host disk. If access to individual partitions is granted, then the
       parameter -mbr can be used to specify an alternative MBR to be used
       (the partitioning information in the MBR file is ignored).
       The diskname is on Linux e.g. /dev/sda, and on Windows e.g.
       \.PhysicalDrive0).
       On Linux or FreeBSD host the parameter -relative causes a VMDK file to
       be created which refers to individual partitions instead to the entire
       disk.
       The necessary partition numbers can be queried with
         VBoxManage internalcommands listpartitions

  renamevmdk -from <filename> -to <filename>
       Renames an existing VMDK image, including the base file and all its exten
ts.

  converttoraw [-format <fileformat>] <filename> <outputfile>
       Convert image to raw, writing to file.

  converthd [-srcformat VDI|VMDK|VHD|RAW]
            [-dstformat VDI|VMDK|VHD|RAW]
            <inputfile> <outputfile>
       converts hard disk images between formats

  modinstall
       Installs the necessary driver for the host OS

  moduninstall
       Deinstalls the driver

  debuglog <vmname>|<uuid> [--enable|--disable] [--flags todo]
           [--groups todo] [--destinations todo]
       Controls debug logging.

  passwordhash <passsword>
       Generates a password hash.

  gueststats <vmname>|<uuid> [--interval <seconds>]
       Obtains and prints internal guest statistics.
       Sets the update interval if specified.

WARNING: This is a development tool and shall only be used to analyse
         problems. It is completely unsupported and will change in
         incompatible ways without warning.

Syntax error: Command missing

C:Program FilesOracleVirtualBox>

C:Program FilesOracleVirtualBox>VBoxManage.exe internalcommands sethduuid J:
VirtualBoxPatch11iPatch11i1.vdi
UUID changed to: d716cc7b-749a-4e0d-83b5-c0abc379f18a

C:Program FilesOracleVirtualBox>VBoxManage.exe internalcommands sethduuid J:
VirtualBoxPatch11iPatch11i2.vdi
UUID changed to: 280d9129-f190-4422-82e1-083f6f750814

C:Program FilesOracleVirtualBox>VBoxManage.exe internalcommands sethduuid J:
VirtualBoxPatch11iPatch11i3.vdi
UUID changed to: e577df83-d2e5-49e9-9a2c-18a29dd8fc84

C:Program FilesOracleVirtualBox>VBoxManage.exe internalcommands sethduuid J:
VirtualBoxPatch11iPatch11i4.vdi
UUID changed to: bf722d45-9fdd-4a9f-a9ec-f646f6156c3d