1.8. Creating Your First Virtual Machine

Click New in the VirtualBox Manager window. A wizard is shown, to guide you through setting up a new virtual machine (VM).

Figure 1.4 Creating a New Virtual Machine: Name and Operating System


On the following pages, the wizard will ask you for the bare minimum of information that is needed to create a VM, in particular:

  1. The Name of the VM will later be shown in the machine list of the VirtualBox Manager window, and it will be used for the VM's files on disk. Even though any name can be used, bear in mind that if you create a few VMs, you will appreciate if you have given your VMs rather informative names."My VM" would thus be less useful than "Windows XP SP2 with OpenOffice", for example.

  2. The Machine Folder is the location where VMs are stored on your computer. The default folder location is shown.

  3. For Operating System Type select the OS that you want to install later. The supported OSes are grouped. If you want to install something very unusual that is not listed, select Other. Depending on your selection, Oracle VM VirtualBox will enable or disable certain VM settings that your guest OS may require. This is particularly important for 64-bit guests. See Section 3.1.2, “64-bit Guests”. It is therefore recommended to always set it to the correct value.

  4. On the next page, select the Memory (RAM) that Oracle VM VirtualBox should allocate every time the virtual machine is started. The amount of memory given here will be taken away from your host machine and presented to the guest OS, which will report this size as the virtual computer's installed RAM.

    Caution

    Choose this setting carefully. The memory you give to the VM will not be available to your host OS while the VM is running, so do not specify more than you can spare. For example, if your host machine has 1 GB of RAM and you enter 512 MB as the amount of RAM for a particular virtual machine, while that VM is running, you will only have 512 MB left for all the other software on your host. If you run two VMs at the same time, even more memory will be allocated for the second VM, which may not even be able to start if that memory is not available. On the other hand, you should specify as much as your guest OS and your applications will require to run properly.

    A Windows XP guest will require at least a few hundred MB of RAM to run properly, and Windows Vista will not install with less than 512 MB. If you want to run graphics-intensive applications in your VM, you may require even more RAM.

    As a rule of thumb, if you have 1 GB of RAM or more in your host computer, it is usually safe to allocate 512 MB to each VM. In any case, make sure you always have at least 256 to 512 MB of RAM left on your host OS. Otherwise you may cause your host OS to excessively swap out memory to your hard disk, effectively bringing your host system to a standstill.

    As with the other settings, you can change this setting later, after you have created the VM.

  5. Next, you must specify a Virtual Hard Disk for your VM.

    There are many and potentially complicated ways in which Oracle VM VirtualBox can provide hard disk space to a VM, see Chapter 5, Virtual Storage, but the most common way is to use a large image file on your "real" hard disk, whose contents Oracle VM VirtualBox presents to your VM as if it were a complete hard disk. This file represents an entire hard disk then, so you can even copy it to another host and use it with another Oracle VM VirtualBox installation.

    The wizard displays the following window:

    Figure 1.5 Creating a New Virtual Machine: Hard Disk


    At this screen, you have the following options:

    • To create a new, empty virtual hard disk, click the Create button.

    • You can pick an existing disk image file.

      The drop-down list presented in the window lists all disk images which are currently remembered by Oracle VM VirtualBox. These disk images are currently attached to a virtual machine, or have been attached to a virtual machine.

      Alternatively, click on the small folder icon next to the drop-down list. In the displayed file dialog, you can click Add to select any disk image file on your host disk.

    If you are using Oracle VM VirtualBox for the first time, you will want to create a new disk image. Click the Create button.

    This displays another window, the Create Virtual Hard Disk Wizard wizard. This wizard helps you to create a new disk image file in the new virtual machine's folder.

    Oracle VM VirtualBox supports the following types of image files:

    • A dynamically allocated file will only grow in size when the guest actually stores data on its virtual hard disk. It will therefore initially be small on the host hard drive and only later grow to the size specified as it is filled with data.

    • A fixed-size file will immediately occupy the file specified, even if only a fraction of the virtual hard disk space is actually in use. While occupying much more space, a fixed-size file incurs less overhead and is therefore slightly faster than a dynamically allocated file.

    For details about the differences, see Section 5.2, “Disk Image Files (VDI, VMDK, VHD, HDD)”.

    To prevent your physical hard disk from running full, Oracle VM VirtualBox limits the size of the image file. Still, it needs to be large enough to hold the contents of your OS and the applications you want to install. For a modern Windows or Linux guest, you will probably need several gigabytes for any serious use. The limit of the image file size can be changed later, see Section 7.24, “VBoxManage modifymedium”.

    Figure 1.6 Creating a New Virtual Machine: File Location and Size


    After having selected or created your image file, click Next to go to the next page.

  6. Click Create, to create your new virtual machine. The virtual machine is displayed in the list on the left side of the VirtualBox Manager window, with the name that you entered initially.

Note

After becoming familiar with the use of wizards, consider using the Expert Mode available in some wizards. Where available, this is selectable using a button, and speeds up the process of using wizards.