This post shows how to import a virtual machine image into VirtualBox. Or more correctly, how to create a VirtualBox guest operating system from an existing .vdi image file.
About a month ago, one of my hard drives gave up suddenly. Well, it wasn’t all that sudden, because for weeks prior, it had been sending signals that were not good.
I just didn’t pay it the attention it deserved.
So one evening, while I was finishing up a post, it sent the last signal and just died. And with that, I lost access to data that was on it. Luckily, I was able to recover all the data, including the VirtualBox folder that contained the virtual machine images of the guest operating systems that I had installed.
Those VirtualBox guest operating systems were used for the latest articles I wrote for DigitalOcean, so I needed to recreate them. Details of how I went about the task follows.
First a quick introduction to the contents of the VirtualBox folder on a Linux distribution.
When you create a guest operating system in VirtualBox, the machine image is created in a subfolder bearing its name under the VirtualBox VMs folder in your home directory. Within all the subfolders in that directory, is a file with a .vdi extension. That file is like an ISO image used to install a Linux or BSD distribution.
With that file, you can recreate the guest operating system on any other machine.
So after recovering my files from the dead, now partially resuscitated, hard drive, I saved the VirtualBox folder as oldVirtualBoxVMs, installed and launched VirtualBox on the new hard drive (same computer, but sporting a new hard drive).
Creating a new guest operating system from the existing .vdi images is really simple. Start by clicking the New button. Give the new guest OS a name and be sure to select the appropriate distribution, which should be the same version as the one whose .vdi image you’ll be importing. Next.
Assign RAM to it. Next.
At the step shown in Figure 3, select the Use an existing virtual hard disk file option, then click on the folder icon to the right of the combo box under it.
Navigate to the folder where you saved the virtual machine image. Select it, then click Open.
Back to this step, click Create. You’ve just created a new VirtualBox guest operating system from an existing virtual hard disk file.
Before starting the new guest operating system, configure it to use bridge networking to get its IP address. To do that, click the Settings button, then click on the Network tab. From Assign to, select Bridged Adapter. OK.
After that, you may start the new guest operating system. Repeat the procedure using other existing virtual machine image that you have to import.