Chapter 5. Virtual storage

Oracle VM VirtualBox

Chapter 5. Virtual storage

As the virtual machine will most probably expect to see a hard disk built into its virtual computer, VirtualBox must be able to present "real" storage to the guest as a virtual hard disk. There are presently three methods in which to achieve this:

  1. Most commonly, VirtualBox will use large image files on a real hard disk and present them to a guest as a virtual hard disk. This is described in Section 5.2, “Disk image files (VDI, VMDK, VHD, HDD)”.

  2. Alternatively, if you have iSCSI storage servers, you can attach such a server to VirtualBox as well; this is described in Section 5.10, “iSCSI servers”.

  3. Finally, as an advanced feature, you can allow a virtual machine to access one of your host disks directly; this advanced feature is described in Section 9.9.1, “Using a raw host hard disk from a guest”.

Each such virtual storage device (image file, iSCSI target or physical hard disk) will need to be connected to the virtual hard disk controller that VirtualBox presents to a virtual machine. This is explained in the next section.

5.1. Hard disk controllers: IDE, SATA (AHCI), SCSI, SAS, USB MSD, NVMe

In a real PC, hard disks and CD/DVD drives are connected to a device called hard disk controller which drives hard disk operation and data transfers. VirtualBox can emulate the five most common types of hard disk controllers typically found in today's PCs: IDE, SATA (AHCI), SCSI, SAS, USB-based and NVMe mass storage devices.[21]

  • IDE (ATA) controllers are a backwards compatible yet very advanced extension of the disk controller in the IBM PC/AT (1984). Initially, this interface worked only with hard disks, but was later extended to also support CD-ROM drives and other types of removable media. In physical PCs, this standard uses flat ribbon parallel cables with 40 or 80 wires. Each such cable can connect two devices to a controller, which have traditionally been called "master" and "slave". Typical PCs had two connectors for such cables; as a result, support for up to four IDE devices was most common.

    In VirtualBox, each virtual machine may have one IDE controller enabled, which gives you up to four virtual storage devices that you can attach to the machine. (By default, one of these four -- the secondary master -- is preconfigured to be the machine's virtual CD/DVD drive, but this can be changed.[22])

    So even if your guest operating system has no support for SCSI or SATA devices, it should always be able to see an IDE controller.

    You can also select which exact type of IDE controller hardware VirtualBox should present to the virtual machine (PIIX3, PIIX4 or ICH6). This makes no difference in terms of performance, but if you import a virtual machine from another virtualization product, the operating system in that machine may expect a particular controller type and crash if it isn't found.

    After you have created a new virtual machine with the "New Virtual Machine" wizard of the graphical user interface, you will typically see one IDE controller in the machine's "Storage" settings where the virtual CD/DVD drive will be attached to one of the four ports of this controller.

  • Serial ATA (SATA) is a newer standard introduced in 2003. Compared to IDE, it supports both much higher speeds and more devices per controller. Also, with physical hardware, devices can be added and removed while the system is running. The standard interface for SATA controllers is called Advanced Host Controller Interface (AHCI).

    Like a real SATA controller, VirtualBox's virtual SATA controller operates faster and also consumes fewer CPU resources than the virtual IDE controller. Also, this allows you to connect up to 30 virtual hard disks to one machine instead of just three, as with the VirtualBox IDE controller (with the DVD drive already attached).

    For this reason, starting with version 3.2 and depending on the selected guest operating system, VirtualBox uses SATA as the default for newly created virtual machines. One virtual SATA controller is created by default, and the default disk that is created with a new VM is attached to this controller.

    Warning

    The entire SATA controller and the virtual disks attached to it (including those in IDE compatibility mode) will not be seen by operating systems that do not have device support for AHCI. In particular, there is no support for AHCI in Windows before Windows Vista, so Windows XP (even SP3) will not see such disks unless you install additional drivers. It is possible to switch from IDE to SATA after installation by installing the SATA drivers and changing the controller type in the VM settings dialog.[23]

    To add a SATA controller to a machine for which it has not been enabled by default (either because it was created by an earlier version of VirtualBox, or because SATA is not supported by default by the selected guest operating system), go to the "Storage" page of the machine's settings dialog, click on the "Add Controller" button under the "Storage Tree" box and then select "Add SATA Controller". After this, the additional controller will appear as a separate PCI device in the virtual machine, and you can add virtual disks to it.

    To change the IDE compatibility mode settings for the SATA controller, please see Section 8.19, “VBoxManage storagectl”.

  • SCSI is another established industry standard, standing for "Small Computer System Interface". SCSI was standardized as early as 1986 as a generic interface for data transfer between all kinds of devices, including storage devices. Today SCSI is still used for connecting hard disks and tape devices, but it has mostly been displaced in commodity hardware. It is still in common use in high-performance workstations and servers.

    Primarily for compatibility with other virtualization software, VirtualBox optionally supports LSI Logic and BusLogic SCSI controllers, to each of which up to 15 virtual hard disks can be attached.

    To enable a SCSI controller, on the "Storage" page of a virtual machine's settings dialog, click on the "Add Controller" button under the "Storage Tree" box and then select "Add SCSI Controller". After this, the additional controller will appear as a separate PCI device in the virtual machine.

    Warning

    As with the other controller types, a SCSI controller will only be seen by operating systems with device support for it. Windows 2003 and later ships with drivers for the LSI Logic controller, while Windows NT 4.0 and Windows 2000 ships with drivers for the BusLogic controller. Windows XP ships with drivers for neither.

  • Serial Attached SCSI (SAS) is another bus standard which uses the SCSI command set. As opposed to SCSI, however, with physical devices, serial cables are used instead of parallel ones, which simplifies physical device connections. In some ways, therefore, SAS is to SCSI what SATA is to IDE: it allows for more reliable and faster connections.

    To support high-end guests which require SAS controllers, VirtualBox emulates a LSI Logic SAS controller, which can be enabled much the same way as a SCSI controller. At this time, up to eight devices can be connected to the SAS controller.

    Warning

    As with SATA, the SAS controller will only be seen by operating systems with device support for it. In particular, there is no support for SAS in Windows before Windows Vista, so Windows XP (even SP3) will not see such disks unless you install additional drivers.

  • The USB mass storage device class is a standard to connect external storage devices like hard disks or flash drives to a host through USB. All major operating systems support these devices for a long time and ship generic drivers making third-party drivers superfluous. In particular legacy operating systems without support for SATA controllers may benefit from USB mass storage devices.

    The virtual USB storage controller offered by VirtualBox works different than the other storage controller types: When storage controllers appear as a single PCI device to the guest with multiple disks attached to it, the USB-based storage controller does not appear as virtual storage controller. Each disk attached to the controller appears as a dedicated USB device to the guest.

    Warning

    Booting from drives attached via USB is when EFI is used as the BIOS lacks USB support.

  • Non volatile memory express (NVMe) is a very recent standard which emerged in 2011 connecting non volatile memory (NVM) directly over PCI express to lift the bandwidth limitation of the previously used SATA protocol for SSDs. Unlike other standards the command set is very simple to achieve maximum throughput and is not compatible with ATA or SCSI. Operating systems need to support NVMe devices to make use of them. For example Windows 8.1 added native NVMe support, for Windows 7 native support was added with an update. [24]

    Warning

    Booting from drives attached via NVMe is only supported when EFI is used as the BIOS lacks the appropriate driver.

In summary, VirtualBox gives you the following categories of virtual storage slots:

  1. four slots attached to the traditional IDE controller, which are always present (one of which typically is a virtual CD/DVD drive);

  2. 30 slots attached to the SATA controller, if enabled and supported by the guest operating system;

  3. 15 slots attached to the SCSI controller, if enabled and supported by the guest operating system;

  4. eight slots attached to the SAS controller, if enabled and supported by the guest operating system.

  5. eight slots attached to the virtual USB controller, if enabled and supported by the guest operating system.

  6. up to 255 slots attached to the NVMe controller, if enabled and supported by the guest operating system.

Given this large choice of storage controllers, you may ask yourself which one to choose. In general, you should avoid IDE unless it is the only controller supported by your guest. Whether you use SATA, SCSI or SAS does not make any real difference. The variety of controllers is only supplied for VirtualBox for compatibility with existing hardware and other hypervisors.


[21] SATA support was added with VirtualBox 1.6; experimental SCSI support was added with 2.1 and fully implemented with 2.2. Generally, storage attachments were made much more flexible with VirtualBox 3.1; see below. Support for the LSI Logic SAS controller was added with VirtualBox 3.2; USB mass storage devices are supported since VirtualBox 5.0; NVMe controller support was added with VirtualBox 5.1.

[22] The assignment of the machine's CD/DVD drive to the secondary master was fixed before VirtualBox 3.1; it is now changeable, and the drive can be at other slots of the IDE controller, and there can be more than one such drive.

[23] VirtualBox recommends the Intel Matrix Storage drivers which can be downloaded from http://downloadcenter.intel.com/Product_Filter.aspx?ProductID=2101.

[24] The NVMe controller is part of the extension pack.