In previous post we saw how to duplicate a virtual machine as a linked clone of existing virtual machine. As result, we have a new virtual machine identical to original. New virtual machine is on the same host as an original virtual machine. We also have a benefit of smaller occupied space on the hard disk of the host machine.
However, if we need to transfer some virtual machine on the other virtual host or to import it a few times, we’ll need different approach. We can make a template and then we can reuse it multiple times.
This template is one single file, containing all necessary files and information to successfully generate new virtual machine on the same or other virtual host. During deployment process we can change some parameters and then adapt new virtual machine to our environment.
Also we can give this template to our customers. All they need to do is to perform simple procedure to deploy this virtual machine. As everything is already set up, a deployment process will be fast and easy.
There is still one limitation in this procedure. If you try to deploy VM appliance made in the VirtualBox to the VMWare server, process will fail. There is a procedure to fix this appliance so that can be used on VMWare. I didn’t tried yet to do so and I can’t say will that works. It should.
The VirtualBox will made appliance in the OVF format. That means that virtual disk format will be changed to VMWare’s vmdk format. This appliance will have an ova file extension.
Exporting the virtual machine
In this demonstration, we will create two appliances. First appliance contains virtual machine under the Microsoft Windows 7 and second contains the Mikrotik RouterOS v6.34 x86 software router.
We can select a virtual machine that we want to export. However, if we didn’t do now, we can select it later from the list.
First step is to choose menu File, then Export appliance. A keyboard shortcut is Ctrl + E.
A new window will popup. We will choose our virtual machine for export. A virtual machine should be turned off. If it’s not, then it will be grayed in this list. We will choose a machine with the name Hobbiton. This is the Windows 7 workstation.
In the next step we should choose destination file name. Our appliance will have ova extension. We also need to choose format version of the appliance (it can be in versions 0.9, 1.0 and 2.0). Preferred version is 1.0.
However, it’s highly recommended to check an option Write Manifest file. That file will make control information that preventing deployment of damaged appliance.
The final step before starting the export process is to enter information about appliance, like name, version, author and so on. Just double click on the property you need to change and type a new value.
This is not mandatory part. However, if you need to have more than one appliance or if you need version control, those information are valuable. Not to mention that it is easier for troubleshooting of the deployment, as we can check those values and immediately knew does customer deploying latest version.
We will click on the button [ Export ] and we began the export process. This process can take some time. It depends on a size of the virtual disk and its format. I using the Microsoft VHD format a lot, as I can then share virtual disk with other platforms, like the Microsoft Virtual PC 2007 or the Microsoft Hyper-V Server 2008/2012.
If you’re not using the vmdk format, the Export wizard needs to convert a virtual hard disk. Therefore, I can recommended to use this format for all virtual machines that need to be exported as an appliances. In that case the Wizard will just pack vmdk disks inside appliance.
Of course, hardware parameters of virtual host can have impact on this process. I done this on virtual host with i5 CPU, 16GB of RAM and SSD drive. Fast hard disk in the virtual host, especially a SSD drive, can speed up this procedure a lot.
In this case, exporting the virtual machine Hobbiton took about a half hour. The virtual disk on this machine is about 20 gigabytes in size. After that, exporting RouterOS virtual machine took just a few seconds. RouterOS uses the 64 MB virtual hard disk for its work.
Checking our appliance
If we went to the folder we choose in second step, we can find our appliance(s) in the file list. If we check now size of this file, we can see interesting details. Our virtual machine is about 20 GB in size and in same time appliance took just 8.3 GB.
We can see another advantage of distribution over appliance. Size is smaller than original virtual machine. That means that we can easier distribute it over Internet, especially when end-user have slower link.
In the next post we will learn how to import this appliance back to the VirtualBox.