Useful and lesser-known features of VirtualBox

Back to Square One

An alternative to Multiple Connect is the Shared type. This type works on the same principle, but VirtualBox creates a fresh differential image each time the virtual machine is restarted. The changes made by the virtual machine and all files created are lost each time the virtual machine is restarted. The Shared type can only be assigned to image files that do not grow dynamically.

If you are using snapshots and you do not want VirtualBox to store the disk image in the current snapshot, you can set the Type to Copy. If you set the Type to Immutable instead, VirtualBox enables write protection. But be careful: The guest system can still change the data of the hard disk image. However, when you restart the virtual machine, VirtualBox restores the image to its original state.

Data you previously thought you stored is then lost. In the background, VirtualBox uses differential images, which it deletes each time the virtual machine is restarted. The Immutable type is therefore only of interest in special cases, such as on publicly accessible computers or on PCs in training rooms, where you want to automatically restore the system to its original state after use.

If an error message appears when you change the type, the disk image is most likely still in use – or it belongs to a snapshot. In these cases, you first need to share the image or delete the snapshots.

Integrated Applications

You can also bring the windows running on a virtual machine to the desktop. VirtualBox calls this mode Seamless Mode, but it can only be enabled if you installed the Guest Additions on the virtual machine and are running Windows or a Linux system with X11 as a guest.

In this case, you need to press the Host key and L. VirtualBox then inflates the virtual machine to the screen size and hides the background of the guest system. To exit this mode, press Host+L again.

On My Command!

VirtualBox comes with the VBoxSDL command-line tool. VBoxSDL starts a virtual machine in a simple window. The VirtualBox developers only used the tool for internal tests of their own work, which is why they do not officially support it. However, it can be useful if you want to start the virtual machine from a script or if you don't want the virtual machine users to interfere with the configuration. To start a virtual machine, pass VBoxSDL the name of the virtual machine in the --startvm parameter (Listing 1, line 1).

Listing 1

VirtualBox from the Command Line

 

As an alternative to the graphical user interface, the virtual machines can be managed with the VBoxManage command-line tool. Like VBoxSDL, VBoxManage offers the advantage that it is suitable for use in your own scripts. In addition, the tool gives you access to some functions that the VirtualBox Manager itself does not offer. To start a virtual machine with VBoxManage, pass the startvm command and the name of the virtual machine to the tool (Listing 1, line 2).

Instead of the name, you can enter the unique identification number (UUID) of the virtual machine. The list command (Listing 1, line 3) reveals which virtual machine has which UUID. Information about a virtual machine is returned by showvminfo (line 4). The virtual machine can also be stopped (line 5), resumed (line 6), restarted (line 7), and turned off (line 8). The restart and shutdown actions correspond to pressing the reset button or unplugging the power plug. If you want to shut down the virtual machine in a controlled manner, send an appropriate ACPI command to the guest (line 9).

VBoxManage also provides the ability to create new virtual machines and customize the configuration of existing machines. The commands required for this don't just look complex and cumbersome, they are. If you don't have scripts to group them, you can put a new machine together far faster in the graphical user interface.

VBoxManage is happily faster when it comes to exporting (listing 1, line 10) and importing (line 11) a virtual machine and its settings to or from a hard disk image.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Networking with VirtualBox

    Tour the VirtualBox virtualization tool, a free and easy environment for virtual versions of Linux, Unix, and Windows.

  • Virtual Box

    Many popular virtualization tools are either too expensive or too complicated. If you’re looking for another option, try the no-cost and user-friendly VirtualBox.

  • phpVirtualBox

    Putting all virtualization tasks on a separate server saves significant resources on the client. phpVirtualBox makes it possible to create, configure, manage, and use remote VMs in a browser window.

  • Virtualization Tools

    Running server systems in virtual environments is a popular approach, but the technology offers benefits to desktop users. In this article, we investigate some virtual desktop alternatives.

  • QEMU and Qemu Manager

    Carry a virtual Linux machine with you wherever you go.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News