Creating virtual machines with Oracle VM VirtualBox 4

In Oracle VM VirtualBox 4, creating virtual machines is simple, and you have several options for hardware settings, memory and virtual NICs.

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 and selecting New, which launches a wizard to help you through the process. There are three easy steps for creating virtual machines with Oracle VM VirtualBox.

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.

Figure 1
Name the virtual machine (VM) and choose the guest OS. (Click image for an enlarged view.)

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.

Figure 2
Assign memory to the VM. (Click image for an enlarged view.)

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.

Figure 3
Choose a dynamically expanding or fixed-size disk. (Click image for an enlarged view.)

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.

Figure 4
Present media to the guest OS. (Click image for an enlarged view.)

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.

Figure 5
You can edit advanced settings and hardware configurations when the VM is powered off. (Click image for an enlarged view.)

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.

Figure 6
Oracle VM VirtualBox has several virtual NIC options. (Click image for an enlarged view.)

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.

Dig Deeper on Oracle VM and other virtualization technologies