Back up virtualbox for a fresh install - while migrating to 64 bit
Solution 1:
You can use the "Appliance Export Wizard" in VirtualBox to export your VM and then import it again on your reinstalled system. I'm using VirtualBox 4.1.8, but this feature has been around for at least a couple of versions.
Exporting a VM
Open VirtualBox
Go to the
File
menu and selectExport Appliance
Select the virtual machine (VM) you want to export and click
Next
Choose where you will save the exported VM and click
Next
Review settings and click
Export
Copy the exported VM to an external hardrive (or put it on a partition that will survive the reinstall). Once you've reinstalled, you can import the VM.
Importing a VM
Open Virtualbox
Go to the
File
menu and selectImport Appliance
Choose the file to import and follow the rest of the prompts.
Solution 2:
Before wiping your drive it is always a good idea to backup your personal data in your home directory.
Therefore I am sure you already have plans to do so. In case your virtual disk images are stored there (usually in the hidden ~/.VirtualBox
directory) your virtual disks will also be included in your backup of your HOME directory and they will be restored fully functional and untouched with your backup later.
However performing an upgrade from 32-bit Ubuntu to 64-bit Ubuntu can be done without deleting your data in your HOME. In case you keep your HOME you will just reinstall the virtual box application in your fresh Ubuntu installation to keep all your virtual machines (including snapshots) untouched.
Having said so, there may of course be cases where a backup of a virtual machine may be necessary (e.g. in case you want to build up a new home directory, you need to change your user name, or the virtual machines are not stored in HOME).
You then have the choice to export and import your machines in the Open Virtualization Format (OVF) either from the virtual box manager GUI or from the command line
VBoxManage export <nameofvm> -o <nameofmachine>.ovf
VBoxManage import <nameofvm>.ovf # use --dry-run first to check configurations
Due to limitations from the OVF format this will not save the current state or snapshots of a given machine. You may clone a virtual machine and register it in a new installation but this may be more work than performing a conventional backup of ~/.Virtualbox
and possible other locations you may have defined for storing the virtual hard disks.
I recommend reading the Virtual Box online manual to get an idea on options, procedures and limitations.