Sandboxing is a term used to describe a computer environment that uses 1 or more computer systems that are logically separated from a production computer environment. The sandbox environment allows administrators to test conditions that will not influence the production environment. Unlike a lab environment that will replicate exactly what exists in a production one, sandboxing is primarily used to test behaviors.
This post will cover how to use VirtualBox to create and operate a sandbox environment. It will not cover the topic extensively, but will serve as a starting point on sandboxing with VMs. Please refer to the VirtualBox documentation for further details.
In a previous post, VirtualBox VM exporting and importing was covered. This feature provides a way to image a VM and store that image for the purposes of restoration or migration to another VirtualBox host. One thing not discussed is the hosting OS limits running VirtualBox. If a VM has a 64 bit base, it can only be imported on a host that can support 64 bit processing. This is worth mentioning again. VirtualBox will only provide VMs with 32 bit support on hosts running 32 bit operating systems. In contrast, hosts with 64 bit operating systems will support either 32 bit or 64 bit VMs. Keep this in mind when exporting 64 bit VMs with the intent to import them on different hosts.
Aside from export and import functions in VirtualBox, there are two other functions that provide system recovery. These are tools that will only be pertinent on the system hosting the VMs.
The first is cloning. VirtualBox Manager has this located in the menu under Machine > Clone. Pressing [Ctrl] + [O] will bring up the dialog as well. This is also available in the Snapshots section of the VirtualBox Manager. The intent is to create a copy of a VM that is separate for its original. The cloning process asks for a new VM name, since multiple VMs cannot share the same name on the same host. It also asks to reinitialize the MAC address, this is needed if the clone will run parallel with its source on the same VM. No system can share the same MAC address on a network with others, otherwise typical network traffic issues will arise. Clone types are either full or linked. Full clones are complete copies of the source VM that are independent of the source. Linked clones share the source VM hard drive and will be bound based on that shared resource. There isn’t much difference between the expert and guided mode of cloning, the export mode only prompts with a single dialog asking all the options. Either way a new clone will appear in the VirtualBox manager when the clone process is complete. If information was entered on the source VM Description section, it will also be available on the clone. This Description section is useful for keeping notes specific to the VM and provides a way for administrators to track changes and status of VMs as they are operated. It is suggested that this be used.
The next function is snapshots. VirtualBox Manager has this located in the Snapshots section or it can be initiated by pressing the [Ctrl] + [Shift] + [S] while in Snapshots. Snapshots are like undos. It provides a way to revert a VM back to a set state without the need of full restoration. Typical uses for snapshots are before installing software, running code, or connecting to a host. The snapshot created before doing any of the mentioned actions allows that VM to revert back to its original condition. When creating snapshots, the name and description are useful items that should be used. This will provide a way to track snapshots in the event a reversion is needed at a much later time. Recalling changes made over long periods of time can prove to be too difficult, using the name and description fields will help avoid that pitfall.
There are more features that VirutalBox offers in the way of Sandboxing, such as shared folders, shared clipboard, or drag and drop. The details of these can be found in the VirtualBox documentation, it should be a go to source for all of the features that VirtualBox offers.