Once you get the hang of Oracle VM VirtualBox 4’s features and terminology, it’s time to create virtual machines (VMs). Virtual machine creation is a simple matter of launching the VirtualBox Manager
Preparing for virtual machine creation
First, name the VM and select the type of guest operating system that it will run (see Figure 1). The guest OS you choose affects default settings you’ll see later in the wizard.
Next, configure the virtual memory you want to allocate to each VM (see Figure 2). Oracle VM VirtualBox does not support memory overcommit, so you can’t assign more RAM to a VM than the host has available. That means all physical memory assigned to a VM is used when the VM is powered on. Oracle VM VirtualBox supports two other virtual memory management features: memory ballooning and Page Fusion.
Memory ballooning allows you to remove physical memory from a VM so other VMs can use it. This feature works only on 64-bit hosts, and it allocates memory with a balloon driver that’s part of the Guest Additions. Page Fusion, which provides RAM deduplication, is also available only on 64-bit hosts. Using logic in Guest Additions, Page Fusion identifies similar memory cells across VMs to achieve page sharing almost immediately and with almost no overhead.
The final step is to create a virtual disk and specify the type and size of the VM’s disk file (see Figure 3). In Oracle VM VirtualBox, you can choose a dynamically expanding or fixed-size disk. The dynamic disk starts out small and grows as the guest OS writes data to it. With the fixed disk type, all disk space is allocated during the virtual machine creation process. It’s also possible to add disks to a VM later, or you can increase the size with the VBoxManage command-line utility.
Installing the guest OS
Once you complete the Oracle VM VirtualBox wizard for creating virtual machines, you can install the guest OS. To present media to the guest, select the VM and click Settings, which lets you edit the VM’s hardware. Next, select Storage in the left-hand pane and then click the CD/DVD graphic under the Storage tree (see Figure 4). Finally, click the CD/DVD graphic with an arrow under Attributes to configure the virtual CD/DVD drive.
You can choose to use a physical CD/DVD drive that’s already on the host computer or browse for an ISO image file. Then power on the VM, which will boot from the media you selected so you can install the guest OS.
When the guest OS is installed, you should install the Guest Additions software, which contains drivers that facilitate integration between the host and VMs. To do so, open the VM console window and select Devices from the top menu. Then select Install Guest Additions, which launches a simple setup wizard. Once the Guest Additions installation completes, reboot the VM.
Virtual machine settings in Oracle VM VirtualBox
You can edit a VM’s settings and change the hardware only when it’s powered off (see Figure 5). Oracle VM VirtualBox features advanced hardware settings that enable IO APIC, PAE/NX and Nested Paging. You can also modify the number of virtual CPUs -- up to 32 -- regardless of the amount of physical CPU cores the host has. But just because you can assign more doesn’t mean you should. If you assign a VM more CPUs than the host has, the VM’s performance will slow to a crawl as Oracle VM VirtualBox tries to funnel many vCPU requests to a limited number of pCPUs.
Configuring virtual NICs
Oracle VM VirtualBox allows you to configure up to four virtual network interface cards (NICs) on a VM, and there are several types of vNIC hardware to choose from (see Figure 6). The default is the popular AMD PCnet-FAST III, which has been around for more than 10 years and is supported by most OSes. You can also choose the AMD PCnet-PCI II and some variations of the Intel PRO-1000 NICs, as well as a paravirtualized NIC that supports direct access to host NICs.
For each vNIC, you can choose from among several different modes of operation. In addition to the common NAT and Bridged networking modes, there are Internal and Host-only networking modes. Internal mode allows you to create an isolated network that only VMs on a specific host can access, meaning there’s no network connectivity to the host itself -- or to any networks that the host is connected to. An isolated virtual environment has no chance of conflicting with anything else on the network. The Host-only mode, on the other hand, adds network connectivity to the host as well via a loopback interface. This mode provides access to the host but prevents access to any physical networks that the host is connected to.
Creating virtual machines in Oracle VM VirtualBox 4 is fairly easy, and there are a variety of settings you can configure to your liking. Once you install the guest OS and choose resource and NIC settings, give Oracle VM VirtualBox a try in a small or development environment.
This was first published in May 2011