Virtualbox Secrets

Get the most of the free virtualisation tool with Keir Thomas’ 10 lesser-known features.
Open source has many jewels in its crown, but few are of the quality of Oracle’s VirtualBox. If you find VMware Player limiting then you’re in luck because VirtualBox provides virtually everything the commercially sold VMware Workstation app does – and it does it for free.
In case you are unaware, virtualisation is the technology that lets you to effectively create a new PC ‘within software’ and install an operating system on it. All the PC settings are held within a file, and a virtual hard disk is created as a series of files too. It’s an ideal way of trying out Linux if you’re a Windows user, as one usage example, but many Linux folk use virtualisation to run Windows for those few tasks when there isn’t a perfect open source option. You can even run Mac OS X within one of these virtual machines, with a little hacking (although the legality is questionable).
You can download VirtualBox from wiki/Downloads, and a single installer is used for both 32- and 64-bit versions of Windows.
Get The Expansion Pack
VirtualBox contains virtually everything you need once installed, but there are a handful of extra drivers provided by an expansion pack that are well worth adding. They bring USB 2.0 support to virtual machines, for example, and remote desktop (RDP) support so you can tune into a virtual machine from another computer via a network or from the Internet. The pack also allows a webcam that is built into a laptop to be used with a virtual machine (standard USB-connected webcams work automatically via USB pass-through).
Alas, the expansion pack isn’t open source. However, it comes with a home user and evaluation license so, unless you’re using VirtualBox for work projects, it’s free of charge. You’ll find the installer for the expansion pack at the same download link as above – and a single package is used for all operating system platforms. Simply double-click the file once it’s downloaded to install it within VirtualBox.
Virtualbox Secrets
Resize The Screen Dynamically
One useful feature VMware Player offers is the ability to adjust the virtual machine’s resolution simply by resizing the virtualisation window. At first glance this isn’t offered by VirtualBox, but it is possible if you install the Guest Tools within the virtual machine. These are separate from the expansion pack mentioned above, and can be installed by clicking the Devices menu on the virtualised machine window, and then Insert Guest Additions CD Image. You’ll need to respond to the prompts within the virtual machine to install the software. The Guest Additions package will need to be built from source on Ubunt, but the process is automated. Should you run into problems on Linux you may need to install GCC and kernel headers via the distro’s package manager. You should also restart the virtual machine once installation has finished.

Virtualbox Secrets
Run Headless
One popular way of using VirtualBox ¡5 to turn off its GUI component and only connect to the ‘screen’ of the virtual machine when you need to. Connecting can be done via the built-in Windows remote desktop app, either on the host PC itself or over the network. Working in this way is referred to as running a virtual machine ‘headless’ and it’s a little like turning off the monitor on a real PC when the computer isn’t in use. It can be useful if you want to experiment with server software that is kept running all the time – perhaps an Apache server used for website development, for example. Just install it on a headless virtual machine, then connect from the host PC.
Start by following the first tip above explaining how to install the Expansion Pack, Then activate remote desktop access for the virtual machine by selecting it within the list within VirtualBox, then clicking the Settings button. Select the Display heading on the left, then select the Remote Display tab, and put a tick in the box marked Enable Server. This can be done even while the virtual machine is up and running.
Starting a virtual machine in headless mode is easy – just hold down Shift before clicking the Play icon within VirtualBox’s main window, after selecting the virtual machine in the list at the left. After giving the virtual machine a few minutes to start­up or resume {look at the Preview thumbnail to see when the desktop appears), use the Remote Desktop (RDP) client built into Windows to connect – you’ll find it on the Start > Accessories menu on Windows 7. In the Computer field of the Remote Desktop Connection dialogue box, type the localhost:3389. Then click the Connect button. To connect over a network, specify the IP address of the host computer, and not IP address of the virtualised computer!
The desktop will appear within an RDP window. Note that closing this window does not quit the virtual machine, which will remain running in the background! Despite the fact that RDP is a Microsoft technology, accessing via RDP can be done for any type of virtual machine, including Linux.
To shutdown the headless machine if an RDP window isn’t open, right-click its entry within the main VirtualBox window and select Close > ACPI Shutdown. Alternatively, select Close > Save State to suspend the machine.

Virtualbox Secrets
Activating Network Pass-through
By default, VirtualBox creates its own private network for virtual machines – a private subnet in the range 10.0.2.*. This is sensible because it isolates the virtual machine yet allows outgoing Internet access. However, it can cause problems for certain network technologies like Windows file sharing running within the virtual machine, which expect all computers to be in the same subnet network range.
One solution is to activate the bridged network setting for the virtual machine. This means the virtual machine uses the host computer’s network connection as if it were directly connected, so will be handed an address by your ADSL/cable router in the same range as any other machine physically or wirelessly connected to the network.
To activate bridging, click the relevant virtual machine within the main VirtualBox interface, then click the Settings button on the toolbar. Select the Network heading in the list on the left, and alongside the Attached To heading, change the dropdown to read Bridged Adapter. In the list below ensure the host PC’s active network connection is chosen, although this should be done automatically. Click OK.
As with many configuration changes, changing the type of network connection can be done while a virtual machine is up and running. The virtual machine will simply go offline, then acquire a new address in the usual way, as if a new network cable has been attached.

Virtualbox Secrets
Port Forward From The Virtual Machine
The previous tip works well if you don’t intend to do anything risky with your virtual machine. However, if you’ve a virtual machine that you use to test what you think might be virus- infected files (for example) then giving it free access to the entire network is a bad idea.
A half-way step if you require network access to the virtual machine is to stick with VlrtualBox’s default private network setting (referred to within VirtualBox settings as NAT), and activate network access to and from the virtual machine via port forwarding. Put simply, this lets you make a port (or ports) on the virtual machine accessible on the host machine, as if the server software were running on the host. As an example, you might run a web server on a virtual machine and forward port 80, so that typing localhost in a web browser running on the host machine will access the virtual machine’s web server. Importantly, however, you must ensure that the port isn’t already in use on the host machine.
To set up port forwarding, open the VirtualBox configuration window, then select the virtual machine’s entry in the list and click the Settings icon. Click the Network entry in the list on the left, then the Port Forwarding button. In the dialogue box that appears, type the port number into the Host Port and Guest Port fields. For example, to forward web traffic (port 80), you’d type 80 into both fields. To forward Windows file sharing (SMB), you’d create separate forwarding rules for ports 137, 138, 139, 389, 445 and 901. The Host IP and Guest IP fields can be left blank.
As with most VirtualBox configuration options, the changes take effect immediately.

Virtualbox Secrets
Create Screencasts
Some people use virtual machines to create teaching environments, separate from the host computer they run on, and VirtualBox includes a simple tool to let you easily create full-screen screencast recordings without the need for add-on software. To activate the feature, shutdown the virtual machine, then open the main VirtualBox window, select the virtual machine in the list, click the Settings icon, and select Display in the list on the left. Select the Video Capture tab, and put a tick in the Enable box. You’ll almost certainly need to adjust the settings beneath because the default capture frame rate is 1 FPS, which will lead to jerky video playback. A frame rate of 5-10 FPS is more acceptable, but beware of anything higher, which will create large video files very quickly. Note that adjusting the Frame Size dropdown doesn’t shrink the video recording’s resolution. Instead it simply crops the frame from the centre outwards.
Files are saved in the .webm video format, also known as the native HTML 5 format, so they should play natively in most modern web browsers (just drag and drop onto a browser window), although VLC ( can be used to play and convert the files.
Video recording will start as soon as the virtual machine does. You can start and stop recording by clicking the Devices > Video Capture menu on the virtual machine window.

Virtualbox Secrets

Go Seamless
One of the most amazing features of VirtualBox is the ability to run virtual machine apps on the host desktop, as if they were running natively. In other words, the apps have their own taskbar button within Windows. This lets you mingle Linux apps with a Windows desktop, or Windows apps with a Linux host PC desktop, without the need to run a full virtualised desktop.
To get started, install the Guest Additions package within the virtual machine. This can be installed by clicking the Devices menu on the virtualised machine window, and then Insert Guest Additions CD Image, as mentioned earlier.
Restart the virtual machine then simply click the View menu on the virtual machine and then Switch To Seamless Mode. To return to a full desktop, hold down the right-hand Ctrl button and tap L. To show the virtual machine configuration menu, hold down the right Ctrl and tap the Home key (which is located above the cursor keys and left of the Page Up/Page Down keys).
Note that Seamless mode doesn’t work correctly when recent releases of Ubuntu are run as virtual machines because of the Unity desktop manager. One potential solution is to enable 3D Acceleration for the virtual machine – select the virtual machine, click Settings, then Display, and put a tick in the box. However, this is a little buggy. The best solution is to replace Unity by installing the Gnome desktop (sudo apt-get install gnome-desktop-envlronment), and select to boot Into that at the Ubuntu login screen.
Alternatively, use a different version of Ubuntu such as Xubuntu, which uses the Xfce desktop.

Virtualbox Secrets

Clone A Virtual Machine
Although you can create snapshots of a virtual machine, recording its state at any given moment, copying a virtual machine setup – to give to another person or for backup purposes – is more difficult than it sounds. Simply copying the virtual machine file might cause issues because each virtual machine requires its own unique ID number.
Luckily, the VirtualBox developers have provided a solution.
To clone a virtual machine, first power it down or suspend it, then right-click the virtual machine’s entry within the list in the main VirtualBox window. Then select Clone and in the ensuing dialogue boxes select the Full Clone option.

7Review earns Amazon affiliate commissions from qualifying purchases. You can support the site directly via Paypal donations ☕. Thank you!

Virtualbox Secrets

Resize A Virtual Machine Disk
The temptation can be to create small virtual machine hard disk files because of limited hard disk space on the host PC, but these small virtual disks can quickly fill up. A solution is simply to enlarge the virtual machine’s hard disk. Unfortunately this isn’t possible via the main VirtualBox user interface, and must be done at the command line. So, before undertaking this tip, it’s a good idea to create a backup of the virtual machine by cloning it as described above. You should also shut down rather than suspend the virtual machine.
To enlarge the disk open a command line window by clicking Start and typing cmd into the search field and hitting Enter. Switch to the VirtualBox directory by typing the following:
cd C:”Program FilesOracleVirtualBox”
Type VBoxManage modifyhd, then drag and drop the virtual machine file on top of the command line window. Finally, at the end of the line, type -resize (note the use of two dashes, rather than one), followed by the new total size you wish the disk to be as measured in megabytes. For example, to resize the disk to 16GB you would type the following, bearing in mind a gigabyte contains 1024 megabytes:
VBoxManage modifyhd “F:Ubuntu.vdi” -resize 16384
The process will complete very quickly. The actual size of the virtual machine file will not increase. You’re simply Increasing the configuration of the virtual hard disk container file.
Additionally, within the virtual machine itself, you’ll need to use a repartitioning tool to increase the size of the operating system partition to make use of the free space. GParted is an excellent choice for both Linux and Windows: livecd.php. Just boot the virtual machine from the GParted ISO image file.
A note of warning: increasing the size of a Windows virtual machine may cause Windows or Office activation software to require relicensing.
Virtualbox Secrets
Scale Virtual Machine Windows
Virtualisation requires a big version of everything – hard disk, memory capacity, and also monitor. After all, the minimum resolution most modern OSes can be run at without user interface issues is 1024×768, and that eats a large chunk of even a 1920×1080 HD monitor’s real estate.
VirtualBox offers a neat solution in the form of scaled window mode. This lets you shrink the virtual machine window in the same way you might shrink a video playback window. Everything will be smaller but still usable. In fact, you’ll probably be able to shrink the virtual machine’s window to 50% of its full size before it becomes difficult to read text and click accurately.
To activate scaled mode, simply select the option on the View menu within the virtual machine window. The actual resolution of the virtual machine will now be fixed at its previous value, but dragging and resizing the virtual machine window will shrink or expand the virtual machine desktop. Conveniently, you can quickly switch back to normal mode, by holding down the right Ctrl key and tapping C.

7Review earns Amazon affiliate commissions from qualifying purchases. You can support the site directly via Paypal donations ☕. Thank you!
We will be happy to hear your thoughts

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.