How to add VirtualBox VMs from a previous installation

Person working on a laptop

Morsa Images/Getty Images

You might have read about my recent article on distro hopping, which led me to use Ubuntu Budgie as my main operating system. Since I depend on virtual machines (for operating system tests and reviews, as well as for various servers I use), I also had to install the VirtualBox virtual machine manager on the new OS.

Normally, when I do that, I can point VirtualBox to the directory housing all of my virtual machines (set as the Default Machine Folder in Preferences > General) and I'm good to go. However, this time I didn't want to automatically import all of those virtual machines at once. 

Also: How to connect to a VirtualBox virtual machine from your LAN

Instead, I decided to add them as needed. Fortunately, that process is very easy and, by adding your VMs this way, the VirtualBox UI won't be so crowded with virtual machines (at least not until you've added them all back).

If this sounds like a situation you've either been in or predict you'll experience in the near future, read on because I'm going to show you how to add those virtual machines back to VirtualBox, one at a time.

How to add a pre-existing VM to VirtualBox

What you'll need: The only two things you'll need for this are a running instance of VirtualBox (on either Linux, MacOS, or Windows), and a collection of pre-existing virtual machines. Once you have those two things in place, you're ready to go.

The first thing to do is open VirtualBox. If you've already set the Default Machine Folder and you still see no VMs listed, it's OK.

From the main VirtualBox window, click the green + Add button. 

The main VirtualBox window.

As you can see, I've already imported a number of VMs back into VirtualBox.

Screenshot by Jack Wallen/ZDNET

When the default OS file picker opens, navigate to the folder housing the VM you want to add.

The Ubuntu Budgie file picker displaying VirtualBox VM folders.

I have quite a large collection of virtual machines to use.

Screenshot by Jack Wallen/ZDNET

Within the folder housing the data for the virtual machine, you'll find a file that ends in .vbox. Select that file and then click Open (or just double-click the .vbox file). 

Also: What are VirtualBox guest snapshots and how do you take them?

This will automatically add the pre-existing virtual machine to VirtualBox so that it's ready to start and use.

The .vbox file shown for elmentary OS.

I'm adding the elementary OS virtual machine back to VirtualBox.

Screenshot by Jack Wallen/ZDNET

There are some things to keep in mind. If you move the virtual machines to a new machine with different architecture (say from Intel to AMD or Arm), the VM might not behave as expected.

Also, if you find networking to be problematic, you might have to switch the network type (say, from NAT to Bridge). Finally, if your VM was in a saved state on the previous host, it will remain so on the new host. If you start it and find that it's not behaving properly, restart the guest OS and it should be back to normal.

Also: How to create a Linux virtual machine with VirtualBox

And that's all there is to adding pre-existing virtual machines to VirtualBox. Keep those VMs stored on a secondary drive, so if you ever need to re-install your host OS, the VMs are ready to be added back.



Source