Creating and Managing VirtualBox Virtual Machines
Having downloaded and installed VirtualBox on a host computer, the next step is to create and run virtual machines within the VirtualBox environment. Virtual machines are created and managed using on of a number of different tools included with the VirtualBox installation. For the the purposes of this chapter, the VirtualBox tool will be used.
Launching the VirtualBox Tool
The mechanism for launching VirtualBox differs depending on the host operating system as follows:
- Linux Host - With some desktop environments, VirtualBox will be available from the System Tools menu. The executable is also located in /usr/bin and may be launched from by entering VirtualBox at a terminal window prompt. if /usr/bin is not currently in the user's $PATH environment variable, the entire path to (/usr/bin/VirtualBox) will need to be entered.
- Windows Host - On Windows hosts, VirtualBox can be launched by selecting Start->All Programs->Sun xVM VirtualBox->VirtualBox. Alternatively, the tool can be launched from the command prompt by changing directory to the VirtualBox installation folder (C:\Program Files\Sun\xVM VirtualBox by default) and executing VirtualBox.
- Solaris Host - With some desktop environments, VirtualBox will be available from the System Tools menu. The executable is also located in /usr/bin and may be launched from by entering VirtualBox at a terminal window prompt. if /usr/bin is not currently in the user's $PATH environment variable, the entire path to (/usr/bin/VirtualBox) will need to be entered.
- Mac OS X Host - VirtualBox can be launched by double clicking on VirtualBox in the Applications folder of the Finder.
When VirtualBox starts for the first time, the following screen appears. Note that the left hand pane contains no existing virtual machines. The next step, therefore, is to create a new virtual machine.
Creating a New VirtualBox Virtual Machine
New virtual machines are created using the Create New Virtual Machine wizard. This wizrd can be launched by clicking on the New button in the toolbar or selecting the Machine->New menu option. After the Welcome screen has displayed, clicking Next displays the VM Name and OS Type screen illustrated below:
Enter a name which will descriptively and uniquely identify the virtual machine and then select the type of operating system to be installed as the guest in the virtual machine. If the exact operating system is not listed it may not be officially supported (see VirtualBox Supported Host and Guest Operating Systems for a list of supported guest operating systems). Even if the guest operating system is not list it may still run inside a VirtualBox virtual machine. In this case, select the operating system which most closely resembles your chosen operating system.
Specifying Virtual Machine Memory
The next wizard screen allows the amount of memory to be allocated to the virtual machine to be defined. This is essentially the amount of physical memory installed in the host computer system which is to be made available to the virtual machine. The amount of memeory allocated on this screen will depend on a number of factors:
- The total amount of physical memory installed in the host computer
- The amount of memory required by the host operating system to operate effectively
- The amount of memory required by the guest operating system to operating effectively
- The number of other virtual machines running on the host concurrently with the new virtual machine and the memory requirements of those virtual machines
Memory allocation is configured using the sliding scale, the maximum value of which is equal to the amount of physical memory installed in the host:
Configuring a Virtual Hard Disk
Once the memory for the virtual machine has been defined, the next task is to configure disk storage. VirtualBox provides a number of options for providing disk space for the virtual machine. A detailed overview of virtual disks is provide in the Understanding and Configuring VirtualBox Virtual Hard Disks chapter.
The most straightforward method for providing a virtual machine with disk storage is to either create or use an existing virtual disk image file. A virtual disk image file is essentially a file which resides on the file system of the host operating system and acts as a disk drive for the virtual machine. VirtualBox supports .vmdk, .vdi and .vhd image files. An existing disk image file may be attached to the virtual machine by clicking on the Existing...' button. Alternatively, a new virtual disk drive can be created using the Create New Virtual Disk wizard by clicking on New....:
The Hard Disk Storage Type screen illustrated above defines the type of the virtual disk drive. The two options available are as follows:
- Dynamically Expanding Storage - The disk image file is created at a minimal size and then grows automatically as more space is needed (up to a specified maximum). This has the advantage that disk space on the host is not used until it is needed but can result in slower performance if the disk needs to be enlarged frequently.
- Fixed-size Storage - The disk image file is created to the specified size. This uses all the allocated space, regardless of whether it is immediately needed, but results in improved disk write performance.
Once the storage type has been defined, clicking Next displays the Virtual Disk Location and Size screen:
By default, the disk image file will be located in the same folder as the other files relating to the new virtual machine. the disk size is specified using the slider control (up to a maximum size of 2TB).
Click Next followed by Finish to create the virtual disk and return to the new virtual machine wizard.
Clicking Next in the wizard displays the Summary screen. Assuming that the information is correct, click Finish to create the new virtual machine. Once the creation process is complete, the new virtual machine will appear in the list pane on left hand side of the VirtualBox window, together with details of the configuration in the Details pane: