Home‎ > ‎VirtualBox‎ > ‎

Backup VirtualBox machine - the easy way

Following procedure I have tried and I practice on VirtualBox version > 4, I have Windows 7 64, Ubuntu 12.04 64 hosts and all kinds of guests from DOS, Windows, Linux to Chromium OS.

I have never used official Import / Export appliance, in our company we use this easy technique.


To create backup of your VirtualBox machine, you need to find out, where is the default directory with virtual machines, in Ubuntu it is /home/$user/VirtualBox VMs, in Windows 7 it is C:\Users\$Username\VirtualBox VMs.

In this directory, there are subdirectories with names of the virtual machines, select the directory with machine you want to backup and copy it all to your backup location.

In Linux, if you use command line, do not forget to use quotes with name of the directory "VirtualBox VMs", there is a blank space after x. In cp command, use -a (archive) options to preserve all attributes including file's groups ownership.


$ sudo cp -ar "/home/user/VirtualBox VMs/Chrome OS amd64-generic/"* /yourdevicename/backup

It is easier to use copy and paste in GUI like Nautilius or Windows Explorer.


To restore virtual machine, all you need to do is delete the broken VM on your host and copy the machine backup directory back from backup to your host machine. Then doubleclick on blue icon .vbox file, in my case Chrome OS amd64-generic.vbox and it will "install" the restored virtual machine back to your VirtualBox including paths. No need to do anything else, before running guest OS, see Beware of below.

Beware of

Before running your guest VM on different host computer, make sure your host meets hardware requirements for guest OS, common mistake is to leave too much RAM reserved for guest VM, but also double-check number of CPU cores or shared folders section.

You may use this method to switch between hosts, in our company, we use this method to move one particular machine between number of host OSes and all host machines have different hardware, still no problem, on Windows host, you need to restart the guest machine once or twice after detecting new hardware, changing screen resolution or installing Guest Additions.

To achieve best performance and prevent unexpected problems, you should always try simulation first in test environment before switching to production environment. You may want to prefer same version of VirtualBox installed on guest OS's, in our company we don't and it still works all fine, but we try to always have the most recent version of VirtualBox installed. 

Once you are done, manage .vdi size and defragment

Once you have finished backing up, you may find your backup .vdi file little bit oversize. This happens a lot on VMs that are used to work with larger files, or large file volumes. In expandable drives, large file copied or downloaded to virtual machine can take space even if deleted, because deleting does not compact the virtual hard drive afterwards. If you have VDI expandable size hard drive (.vdi), you are in luck, because there is an easy way to shrink the .vdi volume size using vboxmange command, acts as de-fragmentation tool too.