9 Advanced topics
This sets up a serial port in the guest with the default settings for COM1 (IRQ 4, I/O address 0x3f8) and the Location setting assumes that this configuration is used on a Windows host, because the Windows named pipe syntax is used. Keep in mind that on Windows hosts a named pipe must always start with \\.\pipe\. On Linux the same config settings apply, except that the path name for the Location can be chosen more freely. Local domain sockets can be placed anywhere, provided the user running VirtualBox has the permission to create a new file in the directory. The final command above defines that VirtualBox acts as a server, i.e. it creates the named pipe itself instead of connecting to an already existing one.
9.10 Using a raw host hard disk from a guest
Starting with version 1.4, as an alternative to using virtual disk images (as described in detail in chapter 5, Virtual storage, page 75), VirtualBox can also present either entire physical hard disks or selected partitions thereof as virtual disks to virtual machines.
With VirtualBox, this type of access is called “raw hard disk access”; it allows a guest operating system to access its virtual hard disk without going through the host OS file system. The actual performance difference for image files vs. raw disk varies greatly depending on the overhead of the host file system, whether dynamically growing im- ages are used and on host OS caching strategies. The caching indirectly also affects other aspects such as failure behavior, i.e. whether the virtual disk contains all data written before a host OS crash. Consult your host OS documentation for details on this.
Warning: Raw hard disk access is for expert users only. Incorrect use or use of an outdated configuration can lead to total loss of data on the physical disk. Most importantly, do not attempt to boot the partition with the cur- rently running host operating system in a guest. This will lead to severe data corruption.
Raw hard disk access – both for entire disks and individual partitions – is imple- mented as part of the VMDK image format support. As a result, you will need to create a special VMDK image file which defines where the data will be stored. After creating such a special VMDK image, you can use it like a regular virtual disk image. For ex- ample, you can use the Virtual Disk Manager (chapter 3.5, The Virtual Disk Manager, page 43) or VBoxManage to assign the image to a virtual machine.
9.10.1 Access to entire physical hard disk
While this variant is the simplest to set up, you must be aware that this will give a guest operating system direct and full access to an entire physical disk. If your host operating system is also booted from this disk, please take special care to not access the partition from the guest at all. On the positive side, the physical disk can be repartitioned in
135