VirtualBox/Basics

VirtualBox
Oracle VM VirtualBox is an x86 virtualization software package maintained by as part of its family of virtualization products. VirtualBox is installed on an existing host operating system.

The physical computer hardware and operating system you have before you install VirtualBox is the "host computer" and "host operating system".

Inside the VirtualBox application, you can create many virtual machines sometimes called "guest computers" which act much like physical computer hardware, except you can't touch it because it's all simulated inside your real physical computer hardware.

Within the VirtualBox application, additional guest operating systems, each known as a Guest OS, can be loaded and run, each with its own virtual environment.

The currently supported host operating systems include Linux, Mac OS X, Windows XP, Windows Vista, Windows 7, Solaris and OpenSolaris. However, there is also a port to FreeBSD (only OSE version).

Hypervisors
Hypervisors are a type of software that manage virtual machines which are, in theory, emulated PCs. Thus, hypervisors can be seen as a type of emulator, in which one system pretends to be another by translating its code into something that can be executed.

Because the IBM PC's architecture, x86, is a complex instruction set by design, it is able to do complex operations that allow it to efficiently emulate other platforms. But how about x86 itself?

In x86, software runs in privilege levels (often called rings) and are organized by the operating system. Operating systems will often run their portion of the code (the kernel) in as low of a level as possible so that it can effectively manage the system and the userspace-- ring 0, thus referred to as the kernel mode. Standard software (like executable files you download from websites) run in ring 3, referred to as the user mode.

VirtualBox virtualizes x86 and does very little emulation of the user mode; instead of translating every instruction on-the-fly, it emulates ring 0 by relocating the virtual kernel code to ring 1 and traps instructions when the kernel or software calls for I/O access (i.e. drivers). There are other specific situations that the developers had to work around, but the rest of the software runs almost unmodified, allowing for near-bare-metal performance of software in many cases.

VirtualBox uses code based on QEMU, but it is not a QEMU fork. QEMU has KVM which allows for it to employ similar practices to VirtualBox, but it also targets a wide variety of platforms outside of x86 (such as PowerPC, ARM, and SPARC) that VirtualBox does not.

Hosts emulating Guests
In the context of virtualization, your main computer is called the host. It has access to physical components like the monitor, the keyboard and mouse, and the hard disk. When running an operating system in VirtualBox, a guest does not have that same access. It's instead replaced with virtual components that are managed by the hypervisor and the OS kernel, like virtual hard disks on the filesystem. VirtualBox allows you to interface with the guest using an emulated keyboard, mouse, and monitor that's as close to generic as possible so that the operating system has the correct drivers. If those drivers are not part of the operating system, VirtualBox will also include Guest Additions that install integrations with the host like clipboard sharing and dynamic resolutions (where the OS will resize the display to the window).

Host CPU requirements
SSE2 (Streaming SIMD Extensions 2) support is required for host CPUs in order for VirtualBox to work.

Virtual Media
Within VirtualBox you will encounter the Virtual Media Manager. This is a list of disks VirtualBox has previously used with guests. The three types-- hard disks, optical disks, and floppy disks-- are memorized and grouped by the manager, and can be removed or copied if needed. When these images cannot be detected at the program's start, it will notify the user.

The list of supported hard drive formats are:


 * (Virtual Disk Image): VirtualBox's native format.
 * (Virtual Machine DisK): Designed by VMware.
 * (Virtual Hard Disk): Previously Connectix's format for Virtual PC, but now used by Microsoft. On a Windows host, these files can be mounted natively in the Disk Management utility.
 * (Virtual Hard Disk Extended): Microsoft's format for Hyper-V.


 * (Hard Disk Drive): Parallels' native format. VirtualBox does not support versions newer than 2, citing lack of documentation on the format. Parallels includes utilities to downgrade the format, however.
 * (Quick Copy-On-Write): Previously QEMU's native format; it's since been succeeded by QCOW2. QCOW2 support is read-only in VirtualBox.
 * : An experimental successor to QCOW that has since been deprecated. Support is only included for compatibility with existing images, and it is recommend to convert to another format.

Floppy disks are a special case as they hold a low amount of data and thus, do not need a special image format to save disk space or speed up the machine.

There are two file extensions,  and , that are often used, but the amount of distinctions between these types are almost entirely zero. Floppy disk images are actually raw formats, as they completely preserve the data of the disk but not the physical aspects.

Dynamic Allocation and Compacting
Dynamic allocation is used in situations where saving space is crucial to your workflow, in which the image uses less space on the disk than it is assigned.

When you delete a file on any computer, the hard disk doesn't actually wipe its sectors (bigger files would take longer to delete if that was the case). Instead, it marks the sectors where the data was stored as overwritable, so that the space is freed. This explains why data recovery is possible; recovery software will search through "empty" sectors for data. To cut down the size of a virtual disk, you need software that will write null values to the empty sectors so that it becomes redundant, thus becoming a pattern that can be compressed. Disks can be compacted using the CLI tool.

File sharing
Files may be shared between the host and guest systems through the guest additions, or otherwise through conventional methods such as SMB and FTP. Should the guest system lack networking capabilities, files can be shared by creating ISO 9660 disc images in an optical disc authoring tool for insertion into the virtual optical disc drive.

The Files
The files for your VirtualBox VMs can be found at:


 * Windows:
 * Linux:

You can quickly access a VM's folder by right-clicking on it from VirtualBox and selecting "Show in File Manager".

The barebones components of a guest's folder includes:


 * A . file. This makes up all the details of the system itself, such as the specs, which images and devices are routed where, etc.
 * A hard disk image

Other components may include:


 * A . file. This is a backup copy of the .  file.
 * A Logs folder. This contains logs of the machine in case anything goes wrong.
 * A Snapshots folder. This contains snapshots.