September 5

0 comments

Are you backing up / cloning your Oracle Virtualbox Virtual Machines?

By Christopher G Mendla

September 5, 2021


Last Updated on September 5, 2021 by Christopher G Mendla

Virtualbox by Oracle is a fantastic tool for creating and using virtual machines. BUT are you backing up your virtual machines?

Overview of Virtualbox and virtual machines.

Many developers run tools such as Oracle’s Virtualbox to run another operating system. For example, you can create a virtual machine running Ubuntu and, with Virtualbox, run that under windows. Many developers rely on VMs.

BEWARE – There are at least two points of failure

When you run a virtual machine on a host machine, a failure of either can cause you to lose countless hours of development and configuration work.

Quite often the life of a developer is constant chaos and crisis management. Or to put it another way, Whack-a-mole on an epic scale.

Why backups are not performed (Excuses and reasons)

There are a number of reasons that someone might neglect to backup their VMs or excuses they might offer:

  • They haven’t been bitten yet – Backups don’t seem important in the scheme of things until you suddenly realize that your virtual machine will not load. The crushing feeling of hundreds, if not thousands of hours of work being obliterated has a profound effect on a dev’s psyche.
  • They have been bitten but they are slow learners. These are the type of people who have previously lost a VM and failed to have a backup. They might have even lost a job or contract because of that. For whatever reason, they recovered and never got on the backup bandwagon.
  • “I’m too busy” – It is easy to get so wrapped up in meeting deadlines and working with projects from hell that time slips by and, despite your best intentions, you don’t do a regular backup.
  • “Everything is on Github” – That may be true except for little things such as
    • Recent work you haven’t pushed
    • Bash aliases and scripts
    • Access keys
    • Notes, screenshots etc.
  • “It takes too much storage” – Come on man. Storage is cheap today. My VMs run about 40 gigs.

The data gods simply don’t care if you have backups or not. If your VM disintegrates and you don’t have a backup, it is your problem.

How to backup

You need to develop your own workflow. The idea is to have a clone of your VM that can be installed on the same or another host machine.

Backups need to be ‘in the cloud’. ie. offsite

The backup should be ‘in the cloud’ or backed up to another physical site. Having a backup of your VM on your host laptop makes no sense at all. The idea is to clone the machine and have that clone, or a copy of that clone in the cloud. Some examples would be Google Drive or Carbonite.

Be sure that any cloud storage is secure. You can be certain that your VM will have sensitive data in it such as keys, passwords and proprietary code.. and maybe emails to your significant other.

Set a retention policy

Older backups can eventually be discarded but you need to decide on a retention policy. There is no right answer. The policy will depend on your particular needs and any contractual/legal obligations.

BACKUPS NEED TO BE TESTED

ANY backup strategy needs to be tested regularly. All too often I see this being neglected. You can easily test your VM backup by cloning the VM and trying to install it under virtualbox on a different host machine.

How to back up or clone an Oracle Virtualbox Virtual Machine

Set a regular time to do the cloning. For example, at the start of every day before you fire up the VM or perhaps every Friday after shutting down for the week. (REALLY – Who works on weekends?)

  1. Open Oracle Virtualbox
  2. If it is already running and you are running your VM, exit the VM
  3. Right click on the VM in the Virtualbox dashboard.
  4. Select ‘clone’
  5. Choose a drive location for the backup. Keep in mind that the goal is to get an offsite backup
  6. Start the cloning, I clone the full VM.
  7. NOTE – the process can take some time depending on your host system and the size of the VM.
  8. When the process completes, look at the file locations and be sure you understand where your backups are.
  9. The cloning process will add another VM to the dashboard. WARNINGS:
    1. You can remove the pointer to the clone but BE ABSOLUTELY SURE YOU ARE REMOVING THE CORRECT ITEM
    2. If you leave the cloned VMs on the dashboard, BE SURE YOU DON”T ACCIDENTALLY START THEM AND START WORKING IN THE CLONE.

Summary

Clones have saved me on a couple of occasions. Make it a regular habit.

JUST START CLONING YOUR VMs NOW!!

Christopher G Mendla

About the author

A web developer living in Southampton, PA

Self motivated critical thinker and problem solver providing technology consulting services.

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}