VMware ESXi and vSphere Cluster Management
How to Create a Virtual Machine in Oracle VirtualBox
Learn how to create a VirtualBox virtual machine, select the guest OS, assign RAM, create a VDI disk, and prepare installation media.
What You Are Creating
A virtual machine (VM) is a software-defined computer that runs on a physical computer. Oracle VirtualBox provides the virtual CPU, RAM, storage, display, and other hardware that the guest system uses.
The physical computer is the host. Its directly installed operating system is the host operating system. The operating system installed inside the VM is the guest operating system.
VirtualBox Manager is the main interface for creating and administering VMs. It creates and manages the VM's virtual hardware, but it does not install the guest operating system automatically.
Before You Begin
- Install Oracle VirtualBox on the host computer.
- Choose the guest operating system you plan to install, such as Windows or Linux.
- Obtain the appropriate bootable ISO image or prepare physical installation media.
- Check that the host has enough free RAM and storage for the VM and its applications.
- Close resource-intensive host applications if the computer has limited memory.
Open the New Virtual Machine Workflow
- Open VirtualBox Manager.
- Select New. This control normally appears near the top of the Manager window.
- Use the New Virtual Machine Wizard to define the VM's initial configuration.
VirtualBox releases can use slightly different labels, page layouts, or combined wizard screens. The underlying choices remain similar: identify the VM, select the guest OS, assign memory, and configure storage.
1. Name the VM and Select the Guest OS
Choose a meaningful name
Enter a name that identifies both the purpose and operating system. For example, Windows 11 Lab, Ubuntu Test, or Linux Web Server is more useful than New Machine.
The name helps you recognize the VM in VirtualBox Manager and may influence automatic operating system detection. VirtualBox can infer an OS family and version from the name, but automatic detection is not guaranteed. Always check the detected values and correct them when necessary.
Select the operating system family and version
Select the closest available OS type or family, such as Microsoft Windows, Linux, BSD, or another supported category. Then select the closest guest OS version and architecture option.
Accurate selection allows VirtualBox to choose more sensible default settings and compatible virtual hardware. If the exact release is not listed, choose the closest supported option recommended by the guest OS documentation.
Choosing an OS type does not install that operating system. It only tells VirtualBox which defaults to use. The actual installation happens later from an ISO image or physical medium.
Check the machine folder
The wizard may show a machine folder, which is the host directory where VirtualBox stores the VM configuration and related files. Choose a location on a drive with sufficient space, especially if you plan to create several VMs.
2. Allocate Virtual Memory
Set the amount of host RAM assigned to the VM. This memory is available to the guest while the VM is running. When the VM is powered off, that assigned RAM becomes available to the host again.
Balance the guest's requirements against the host's needs. A guest OS may need more memory for a graphical desktop, development tools, or multiple applications, while a lightweight test system may work with less.
- Do not assign nearly all host RAM to the VM.
- Leave enough memory for the host operating system and its applications.
- Use the guest OS documentation as a starting point for minimum and recommended memory.
- If the host becomes slow or starts swapping heavily, reduce the VM's memory allocation.
Memory is usually configurable after creation, but the VM should be powered off before changing it.
3. Create or Attach a Virtual Hard Disk
A typical guest OS needs a virtual hard disk for its system files, updates, applications, and user data. VirtualBox usually represents this disk as one or more files stored on the host computer. The guest sees the file through virtual hardware as a disk drive.
The wizard generally provides these choices:
- Create a new virtual hard disk: Use this for a fresh guest OS installation.
- Use an existing virtual hard disk: Select a disk file that already contains a guest system or data.
- Defer disk attachment: Create the VM without storage and attach a disk later when that workflow is appropriate.
If you attach an existing disk, confirm that it belongs to the intended guest OS and is not being used for simultaneous writable access by another running VM. An existing bootable disk may not require a new operating system installation.
A virtual disk can be moved or reused, but its VM configuration, file path, controller settings, and other storage dependencies must be handled correctly. Moving only one file without updating the VM can cause attachment or boot errors.
4. Choose the Virtual Disk Format
For a standard VirtualBox-only setup, select VDI, which means VirtualBox Disk Image. VDI is VirtualBox's native virtual disk format and is the straightforward choice when you do not need to move the disk to another virtualization product.
Other formats can be useful for importing, exporting, or interoperability with different virtualization platforms. They are not normally necessary for a new VM intended to remain in VirtualBox.
5. Choose Dynamic or Fixed-Size Storage
Next, select how the virtual disk file should use space on the host.
| Allocation type | Host-space behavior | Creation time | Typical use case | Considerations |
|---|---|---|---|---|
| Dynamically allocated | The host file grows as the guest writes data, up to the configured maximum. | Usually faster because the full capacity is not reserved immediately. | Test VMs, home labs, and hosts with limited free space. | Monitor host free space as the disk grows. Fragmentation or growth overhead may affect performance in some workloads. |
| Fixed size | The configured capacity is reserved on the host during creation. | Usually takes longer because the full file is created or allocated. | Stable workloads where predictable host allocation is important. | Requires enough free space immediately, even if the guest has not yet used all capacity. |
A dynamically allocated disk does not have unlimited growth: it stops at its configured maximum. A fixed-size disk consumes its configured capacity on the host from the beginning. Either type can support a normal guest OS installation.
6. Set Disk Name, Location, and Capacity
Disk filename and location
Set the virtual disk filename and host folder. A descriptive filename can make storage management easier, especially when several VMs exist. Select a host drive with enough free space and avoid placing large VM files in a location that is routinely cleaned or synchronized unexpectedly.
Changing the disk location changes where the large virtual disk file is stored on the host. It does not change the disk identity seen by the guest. If you move the file later, use VirtualBox's storage management features or update the VM's attachment path rather than moving it blindly.
Disk capacity
Choose a maximum capacity that covers:
- The guest operating system's requirements.
- Updates and recovery files.
- Applications and development tools.
- User documents and test data.
- Reasonable future growth.
Check host free space before confirming. This is especially important for fixed-size disks, multiple VMs, and dynamically allocated disks that may eventually approach their maximum size. The virtual capacity is separate from the amount of host space currently consumed, although the guest must still have enough virtual capacity for its workload.
Configuration Choices at a Glance
| Setting | What it controls | Recommended decision basis | Potential issue if chosen poorly |
|---|---|---|---|
| VM name and OS type | Identifies the VM and influences default hardware settings. | Use a clear name and select the closest accurate guest OS family and version. | Confusing VM identification or unsuitable defaults. |
| Memory allocation | RAM available to the guest while it runs. | Balance guest requirements with the host's available memory. | A slow or unstable host, or an unusable guest. |
| Disk format | The file format used for the virtual disk. | Use VDI for a normal VirtualBox-only VM. | Unnecessary conversion or compatibility work. |
| Disk allocation method | When host storage is consumed. | Use dynamic allocation for flexibility; use fixed size when immediate reservation is acceptable. | Unexpected host storage consumption or lengthy creation. |
| Disk capacity | The maximum storage presented to the guest. | Plan for the OS, updates, applications, and data. | The guest runs out of space or the host runs out of storage. |
| Disk storage location | The host folder containing the virtual disk file. | Choose a reliable drive with adequate free capacity. | Slow storage, missing files, or attachment errors after moving files. |
7. Complete VM Creation
- Review the VM name, guest OS type and version, memory, disk format, disk allocation method, capacity, and storage location.
- Select Finish or the equivalent confirmation control.
- Wait for VirtualBox Manager to create the VM and its initial configuration.
The result is a configured but initially empty virtual computer. It has virtual hardware and, if you created or attached one, virtual storage, but it does not necessarily have an installed operating system.
8. Prepare for Guest OS Installation
The next stage is to attach bootable installation media. Most users use an ISO image, which is a disk-image file containing operating system installation media. Physical installation media can also be used when the host and VirtualBox configuration support it.
- Select the new VM in VirtualBox Manager.
- Open its settings or start action and locate the virtual optical drive.
- Mount the guest OS ISO in that drive.
- Start the VM and confirm that it boots from the installation media.
- Follow the guest OS installer to install the system onto the virtual hard disk.
The VM must boot from valid installation media before the guest OS can be installed. If the VM starts without showing an installer, verify that an ISO is attached, that the ISO is bootable, and that the boot settings allow the virtual optical drive to be used.
For the installation procedure itself, continue with the guest operating system installation workflow when that lesson is available in your course.
Practical Examples
Windows virtual machine
- Use a name such as
Windows 11 Lab. - Verify that VirtualBox selected the appropriate Microsoft Windows family and version.
- Assign RAM based on Windows requirements while leaving sufficient memory for the host.
- Create a VDI disk large enough for Windows, updates, applications, and planned files.
- After creation, attach the Windows installation ISO to the virtual optical drive.
Linux test VM on a storage-constrained host
- Select the correct Linux family and the closest available version or architecture.
- Create a dynamically allocated VDI so the host does not consume the full maximum capacity immediately.
- Choose a realistic maximum size for packages, snapshots, and test files.
- Keep enough host RAM and disk space available for the primary operating system.
- Monitor host free space as the virtual disk grows.
Using an existing virtual disk
- Choose Use an existing virtual hard disk instead of creating a blank disk.
- Confirm that the file belongs to the intended guest OS and is compatible with VirtualBox.
- Make sure another running VM is not using the same disk for simultaneous writable access.
- Boot from the existing disk; a new OS installation may not be necessary if it is already bootable.
Troubleshooting
VirtualBox selects the wrong operating system
The VM name may not clearly identify the intended OS, or automatic detection may not recognize the naming pattern. Manually select the correct OS family and version before completing the wizard. If the exact release is absent, choose the closest option recommended by the guest OS documentation.
The host becomes slow after starting the VM
Too much RAM may have been assigned to the guest, leaving insufficient memory for the host. Power off the VM, reduce its memory allocation, and close unnecessary host applications. A workload that consistently needs more memory may require additional physical RAM.
There is not enough host disk space
The selected capacity may exceed available storage, a fixed-size disk may require immediate full-capacity allocation, or a dynamically allocated disk may have grown near its maximum. Choose a host location with sufficient capacity, reduce the planned disk size when appropriate, or use dynamic allocation for a storage-constrained test environment. Continue monitoring free space.
The VM cannot begin OS installation
No bootable ISO or physical medium may be attached, or the ISO may be invalid or non-bootable. Mount a valid installation ISO in the virtual optical drive and check the boot settings if the VM does not start from it.
A virtual disk cannot be attached
The disk file may be missing, moved, incompatible, or already in use by another running VM. Verify the file path and format, shut down other VMs using the disk, and avoid simultaneous writable use of one disk file.
Key Points to Remember
- The host is the physical computer and its operating system; the guest runs inside the VM.
- VirtualBox Manager creates and manages virtual hardware but does not install the guest OS merely because an OS type is selected.
- Allocate RAM conservatively so the host remains usable.
- VDI is the natural disk format for a VirtualBox-only setup.
- Dynamic disks grow as needed; fixed-size disks reserve their capacity during creation.
- Plan disk capacity and location using both guest requirements and host free space.
- After creating the VM, attach bootable installation media to the virtual optical drive before starting the guest OS installation.