How to Create a Virtual Machine in Oracle VirtualBox
Learn how to create a VirtualBox virtual machine, choose guest OS settings, assign RAM, create a VDI disk, and prepare for OS installation.
A virtual machine (VM) is a software-defined computer that runs inside a physical computer. Oracle VirtualBox presents virtual hardware such as memory, storage, a processor, and network devices to the VM.
The physical computer runs the host operating system. The operating system installed inside the VM is the guest operating system. For example, Windows can be the host while Ubuntu runs as the guest.
Creating a VM prepares its virtual hardware and storage. It does not install the guest operating system. After creation, you must attach installation media, usually an ISO image or physical disc, and install the guest OS. Review VirtualBox system requirements before starting.
Before You Begin
- Install Oracle VirtualBox on the host computer. You can follow the instructions for Windows or Linux.
- Know which operating system and release you plan to install.
- Have the guest OS installation ISO or another form of installation media available.
- Check available host RAM and free disk space.
- Choose a host drive with adequate capacity and suitable performance for the VM files.
Open the New Virtual Machine Wizard
- Open Oracle VirtualBox Manager, the main application used to create, configure, and start VMs.
- Select New to launch the New Virtual Machine wizard.
- Use the wizard to define the VM identity, guest OS profile, memory, and virtual storage.
The exact labels or layout can vary between VirtualBox releases, but the decisions are the same: identify the guest, allocate resources, and create or attach storage.
Name the VM and Select the Guest Operating System
Enter a recognizable VM name, such as Windows 11 Test or Ubuntu Learning Lab. A useful name makes it easier to identify the VM later, especially when several VMs are listed in VirtualBox Manager.
VirtualBox may infer the operating-system family and version from the name. For example, a name containing a recognized Windows or Linux release may cause VirtualBox to select matching defaults automatically.
- Enter the VM name.
- Review the detected operating-system type and version.
- Manually correct the type or version if detection is wrong or does not match the installation media.
The selected guest OS profile influences default virtual hardware choices. It does not install the operating system and should not be treated as a substitute for selecting the correct installation media.
Assign Virtual Memory
RAM is host memory temporarily assigned to the guest while the VM is powered on. Set the memory amount in the wizard according to the guest operating system and the workload you expect to run.
- More RAM can improve guest performance, particularly for desktop operating systems and memory-intensive applications.
- RAM assigned to a running VM is unavailable to the host and other applications.
- Leaving too little memory for the host can make the physical computer slow or unresponsive.
- A lightweight or server-focused Linux guest may need less memory than a full desktop installation.
Use the guest OS requirements as a starting point, then leave enough RAM for the host operating system and your normal host applications. You can adjust the VM's memory later while it is powered off.
Create or Attach Virtual Storage
A VM needs a virtual hard disk for persistent guest files and operating-system installation. This disk is normally a file stored on the host, but the guest sees it as a physical disk.
The common choice during initial setup is Create a new virtual hard disk. You may also attach an existing compatible virtual disk when migrating or reusing a VM. Disk files can support portability between compatible VirtualBox hosts when the related VM configuration is handled correctly. Licensing requirements for the guest operating system and applications still apply.
For a new VM, select the option to create a new disk and continue to the disk format selection.
Select VDI as the Virtual Disk Format
VDI, or VirtualBox Disk Image, is VirtualBox's native virtual disk format. It is the appropriate choice for a typical VM that will be used only with VirtualBox.
Disk format and disk allocation type are separate decisions:
- Disk format identifies how the virtual disk is represented and which virtualization products may support it.
- Allocation type determines when host storage is consumed: as the guest writes data or when the disk is created.
Alternate formats can be useful when interoperability with another virtualization product is important. Choose VDI for a normal VirtualBox-only setup.
Choose Dynamic or Fixed-Size Allocation
A dynamically allocated disk starts with a smaller host file and grows as the guest writes data, up to its configured maximum capacity. A fixed-size disk reserves its full configured capacity on the host when it is created.
Neither option removes the need to plan adequate host storage. A dynamically allocated disk can still fill the host drive when the guest approaches its maximum capacity.
Set the Disk File Name, Location, and Capacity
- Enter a recognizable virtual disk filename. Include the guest name or purpose so the file is easy to identify.
- Choose the folder where VirtualBox will store the VM and disk files.
- Select the maximum disk capacity exposed to the guest.
- Review the location and capacity before finishing.
Choose capacity for the operating system, updates, applications, and planned user or lab data. Do not size the disk only for the initial installation. Store it on a drive with enough free space for the selected allocation type, future growth, and any planned snapshots.
A large maximum capacity does not mean a dynamically allocated disk immediately consumes that entire amount, but the host must eventually be able to accommodate its growth. A fixed-size disk needs the full capacity available during creation.
Review and Finish VM Creation
Review the VM name, guest OS type and version, memory allocation, disk format, allocation type, storage location, and maximum capacity. Select Create to finish.
The result is an uninstalled VM with virtual hardware and virtual storage defined. It is not yet a usable guest computer until an operating system is installed.
The next task is to attach the installation ISO or other installation media and start the VM. Continue with installing a guest operating system or learn how to add a virtual DVD or CD-ROM drive.
VM Setup Decisions and Their Effects
Practical Examples
Create a Windows VM
- Enter a name identifying the Windows release.
- Verify that VirtualBox selected the correct Windows family and version, correcting it manually if needed.
- Assign memory appropriate for the Windows installation while preserving enough RAM for the host.
- Create a VDI disk large enough for Windows, updates, applications, and planned files.
- Use dynamic allocation when conserving immediate host storage is important.
Create a Linux Learning VM
- Name the VM after the Linux distribution or lab purpose.
- Confirm or select the corresponding Linux type and version.
- Allocate moderate RAM for a desktop installation, or less for a lightweight server-focused guest when its workload allows.
- Store the VM on a drive with room for package updates, lab files, and any planned snapshots.
Choose Allocation Based on Host Storage
Use dynamic allocation when you want a large maximum guest disk but cannot spare all of that space immediately. Use fixed-size allocation when predictable reservation is more important and the host has enough capacity to allocate the full disk at creation.
Troubleshooting VM Creation
The wrong operating-system type or version is selected
The VM name may not clearly identify the intended guest, or automatic detection may not match the installation media. Manually select the correct OS family and version before creating the VM.
The host becomes slow while the VM runs
Too much host RAM may have been assigned to the guest. Power off the VM and reduce its memory allocation, while retaining enough memory for the guest OS to operate.
The VM cannot be created because the drive is full
The selected storage location does not have enough free space. Free host storage, choose another drive or folder, reduce planned disk capacity where appropriate, or use dynamic allocation. Remember that dynamic allocation still requires room for later growth.
The guest later reports insufficient disk space
The virtual disk capacity may be too small for the OS, updates, applications, or data. Plan a larger disk during creation, or use supported virtual-disk resize and guest-partition expansion procedures afterward.
The virtual disk is in an unexpected folder
The default location may have been accepted without review. Choose the desired storage path during disk creation and confirm that the target drive remains available.
Exam-Relevant Notes
- The host operating system runs VirtualBox; the guest operating system runs inside the VM.
- Creating a VM defines virtual hardware and storage but does not install the guest OS.
- VDI is the native VirtualBox disk image format.
- A dynamically allocated disk grows on the host as guest data is written, up to its maximum.
- A fixed-size disk reserves its full configured capacity when created.
- Guest RAM is taken from the host while the VM is powered on, so host memory must be preserved.
- Disk capacity is the maximum storage exposed to the guest, not necessarily the amount immediately consumed by a dynamic disk.
Continue Learning
- Learn about VirtualBox virtual disks.
- Understand disk image files.
- Review VirtualBox memory management.
- Configure NAT networking after the guest OS is installed.
- Install Guest Additions for enhanced guest integration.