Best way to create backups of VM's?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
omega1
Posts: 46
Joined: 7. Nov 2013, 12:53

Best way to create backups of VM's?

Post by omega1 »

Hi all,

I would like some input / suggestions on the best way to accomplish this:

I run a number of VM's on my Windows host and would like to be able to create copies for the purpose of backing up should I lose my data on the host machine (and therefore all my VM's).

i would like to create periodic backups (daily/weekly) and store them at a remote location should I lose my data on the host machine.

- Should I use snapshot, clone or just copy the .vdi file? When I do this, does it have to be shut down?
- Can I automate this procedure? If yes, how?
- Any other items I should consider to make this happen?

Thanks in advance for comments, advice, etc...
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Best way to create backups of VM's?

Post by mpack »

Snapshots have nothing to do with making backups, so you should disregard that idea. Nor should you copy only the VDI files: disks can't run themselves, you need to back up the entire virtual PC.

The best way to make a backup is to shut down (not suspend) the VM, then copy the entire VM folder, with contents, to secondary storage.

VMs can also be backed up from the inside, using the same tools that you might run on a physical PC. This can be more complicated to do however.
omega1
Posts: 46
Joined: 7. Nov 2013, 12:53

Re: Best way to create backups of VM's?

Post by omega1 »

Hi,

Thank you for your reply.

If I copy the entier folder where all the files are, what would be the process for recovering the VM in the case that I lose data, would it be via the 'New' option and pointing it to the hard drive, or via the 'Add' feature?

Thanks again.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Best way to create backups of VM's?

Post by mpack »

Just to be clear: I said the entire VM folder, I did not mean the parent folder that contains all the VMs. While you can obviously back up all VMs at once, it's usually better to backup each VM seperately, as required.

To recover, you just copy the folder back. This repairs all damage done inside the VM folder. If the VM registration was lost as well (requires damage to the entire host disk) then you would use the Machine|Add... feature to re-register the .vbox file.

As regards automation: I guess you could have a shutdown script do it in the evening. However I don't bother with automation - I just kick off a copy then go for a coffee - so I'll let someone else advise you on that sort of thing.
omega1
Posts: 46
Joined: 7. Nov 2013, 12:53

Re: Best way to create backups of VM's?

Post by omega1 »

Hi,

Sorry, I'm confused...

I create and store all my VM's in the folder C:\VMs. Oracle VirtualBox runs from c:\Program Files\Oracle\VirtualBox but I am not aware that anything else is saved there?

Do I have to also backup c:\Program Files\Oracle\VirtualBox?

Maybe to avoid any confusion I should backup c:\Program Files\Oracle\VirtualBox AND C:\VMs and put them back in exactly the same place?

Could you clarify?

Thanks again in advance.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Best way to create backups of VM's?

Post by mpack »

Moved to "Windows Hosts" since your discussion just became host-OS specific.

So you overrode the default machine folder but kept it on the C: drive?

VirtualBox stores its own executable files in "C:\Program Files\Oracle\VirtualBox". You do not need to back up this folder. If it got damaged you would just reinstall.

VirtualBox stores GUI preferences, including a list of registered VMs, and your preferred VM container folder path, in the file <userdoc>\.VirtualBox\VirtualBox.xml. You could back this up, but nothing really important is stored there. I don't bother backing this up as damage is unlikely and I can always reregister the VMs.

VirtualBox creates new VMs in the folder specified in the GUI option File|Preferences|Default Machine Folder. By default this is set to <userdoc>\"VirtualBox VMs". Inside this container folder are the VM folders, i.e. if you create a VM named "Omega1" then the VM folder will be called "Omega1", and inside that you'll find "Omega1.vbox" and "Omega1.vdi", plus "Logs" and "Snapshots" subfolders (the latter only when needed). The entire Omega1 folder should be copied to secondary storage in order to back up the Omega1 VM.
omega1
Posts: 46
Joined: 7. Nov 2013, 12:53

Re: Best way to create backups of VM's?

Post by omega1 »

Got it!

One more thing, if I have an issue and have to re-install VirtualBox on the same (or a different) host, I copy back the folders and I assume I select 'Add' to add them back to VirtualBox, rather than 'New'?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Best way to create backups of VM's?

Post by mpack »

Yes, you use "Add" to add existing VMs to the GUI. You only use "New" to create new VMs.
omega1
Posts: 46
Joined: 7. Nov 2013, 12:53

Re: Best way to create backups of VM's?

Post by omega1 »

Hi mpack,

That's great. I sincerely appreciate your time help on this one.

Many thanks!
antoniofr
Posts: 3
Joined: 22. Nov 2015, 17:36

Re: Best way to create backups of VM's?

Post by antoniofr »

This method is very good:

viewtopic.php?f=6&t=74793
Post Reply