VirtualBox Guest Additions
Once you have a guest installed and running, you should install the VirtualBox Guest Additions for the guest OS, which provide the following features:
- Mouse integration: no longer will the mouse and keyboard be "captured" solely by the guest. Simply moving the mouse over the guest OS window will seamlessly direct mouse movement and clicks to the guest. Moving the mouse pointer outside of the guest OS window will automatically "free" the mouse, and mouse activity will be directed to the host OS. The operation is smooth and seamless.
- Enhanced video support: in addition to providing enhanced video acceleration and performance, with guest additions, when you resize the window that contains the guest OS, it automatically adjusts its resolution to fit the size of the window. As a result, when you make the containing window bigger or smaller, the guest OS will resize its desktop to fit.
- Seamless mode: when enabled, windows and applications from the guest OS will float alongside applications and windows running on the host OS, seamlessly. This gives the illusion that the guest's applications are running right there on the host natively (more on this later).
- Full screen mode: when enabled, you can set the guest OS to take over the full screen. It will appear that the guest is the only OS running unless you move the mouse to one of the screen edges, or press a special key to exit this mode.
- Time synchronization: allows the guest OS time to be periodically synchronized to the host OS.
- Automated logins: passes user credentials from the host to Windows guests (only) for automated, yet secure, logins.
- Shared folders and clipboard: the clipboard and folders that you specify can be used to transfer information between the host and guests OS's. For example, you can copy text from an application on the host, and paste it directly into and application running in a guest, and vice-versa. Also, you can specify directories on the host to be mapped directly to the guest so you can easily share and copy files between the two.
Guest Additions are available for Windows (NT 4, 2000, XP, Server 2003, Server 2008, Vista, and Win 7), Linux (Ubuntu, SUSE/openSUSE, RHEL, and Fedora), Solaris 10, OpenSolaris, and OS/2. This is an invaluable set of features that make using VirtualBox a pleasure. To get the most of your virtual environment, I recommend you install it right after creating a new guest OS.
Inside VirtualBox Seamless Mode
Figure 3 shows Windows running in VirtualBox seamless mode on my Mac OS X host. The desktops of the guest and host are combined such that it appears the guest applications are running natively on the host. Taskbars are integrated, to a degree, but seamless mode often works best with the taskbar in auto-hide mode. I like to place the Windows taskbar up with the Mac OS X menu bar, although you can place it on any edge of the desktop (such as the side, or with the OS X Dock).
VirtualBox Command-Line: Fast Stops and Starts
Virtualbox includes a command-line interface that lets you write scripts to control and automate almost any aspect of VirtualBox, and the guests running within it. For instance, I often switch between guests, and don't like to wait for them to boot up and subsequently shut down. Instead, I launch custom scripts that use the VirtualBox command-line to save a running guest, and then restore it when I need it.
Each operation takes literally seconds to complete, and as a result, I can have Windows XP running on my Mac in a snap. As an added bonus, the guest starts in the state I last saved it, which again saves me time as I don't need to wait for, say, Visual Studio or Microsoft Word to launch.
To begin, start your guest OS (Linux, Windows, Solaris, and so on), and when you're ready to close it, execute the following from the command-line:
VBoxManage controlvm <GUESTNAME> savestate
You'll need to replace the text <GUESTNAME> with the name of the guest you're saving. This command will simultaneously save and close the guest. Subsequently, when you're ready to run the same guest again, execute the following from the command-line:
VBoxManage startvm <GUESTNAME>
To make it easier, I've created two scripts per guest on my Macbook; one to save and close a guest; and the other to restore and open it. I've also created desktop shortcuts with nice icons so I can easily launch or close a guest (see Figure 4).
Other features of the VirtualBox command-line include the ability to:
- Create your own VirtualBox management front-end
- Create and install new virtual machines
- Delete existing virtual machines
- Gather information from a running guest
- Change settings (such as video, audio, network, and so on) for existing guests
- Snapshot an existing guest for restoration later
- Import or export a guest image to use on other machines, or from other virtualization software
- Manage DHCP and other network settings for a running guest
- Control virtual devices, such as disks and USB-connected peripherals