Comand Script - backup virtual machines overnight

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Elidan
Posts: 2
Joined: 28. Nov 2013, 17:13

Comand Script - backup virtual machines overnight

Post by Elidan »

Hi

I have been looking at backing up virtual computers overnight. I was just wanting to check that I am on the right track here...

If I used 'controlvm "computer name" shutdown' to shutdown the computer
then ran 'clonevm "computer name" --basefolder h:\vmcomp' after that to copy the hard drive to a backup drive

would I need to schedule startvm to run later or could it be put in the same script to run when the clone is finished? is so would it be a simple matter of scheduling a couple of batch files overnight in order to make safe vm backups of my computers?

thanks in advance
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Comand Script - backup virtual machines overnight

Post by noteirak »

Subjet has been discussed quite a few times - but yes you can of course restart a VM within the same script. Why couldn't you?

On the other hand, using the clone command for a backup means you are NOT doing a backup, but a new copy of the VM with many important IDs reset within.
You may encounter activation problems as well as network issues - see vboxmanage clonevm User Manual entry for details.

What you should do is a copy of the VM folder. This way you will have the same VM in case you need to restore.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Elidan
Posts: 2
Joined: 28. Nov 2013, 17:13

Re: Comand Script - backup virtual machines overnight

Post by Elidan »

Thanks for the advice.

So basically the clone is totally unnecessary and a scheduled shutdown and startup would be easier with a file copy in between.
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: Comand Script - backup virtual machines overnight

Post by mpack »

The purpose of cloning is to create a new VM which is a copy of an existing VM. If all you want to do is make a backup of the existing VM then simply copying the VM folder is all you need: ideally with the VM fully shut down (not suspended). Btw, it's a folder copy - copying (say) just the VDI file does not make an adequate backup. The control files are important too.
Post Reply