Showing posts with label virtualization. Show all posts
Showing posts with label virtualization. Show all posts

3 Mar 2014

DOS Batch to backup virutalbox machines

This DOS script can be used to schedule backups of your virtuabox machines.

The backup consist in a simple copy of the VMs file into a backup folder.
But this script, in case of a RUNNING machine, will also change the state of the vm to SAVESTATE before proceding with the backup, and will bring it back to RUNNING after the copy is completed.

Requirements:
  • gnugrep must be installed (download it from here . PS: remember to dowload also the "Dependencies" package form here, which contains the required DLLs if you don't already have it);
  • change the 3 variabiles (highlithed in red) according to your needs (without trailing backslash):
  1. VBDIR --> the location of the virtualbox manager installation
  2. VMDIR  --> the base forder of your virtualmachines files
  3. BAKDIR --> the folder where you want to copy the VMs to
  • create as many SUBSCRIPT as you need, one per each VM you want to backup; 
  • in each SUBSCRIPT, update the MYVM (yellow) variable with the name of the virtual machine (the one you see in the virtual box manager);


Script:


@echo off

set VMDIR="c:\virtual_machines"
set VBDIR="C:\Program Files\Oracle\VirtualBox"
set BAKDIR="D:\Backup\VM"

date /t > %BAKDIR%\bak.log
time /t >> %BAKDIR%\bak.log
@echo using virtualbox bin folder: %VBDIR%
@echo using virtualbox machines folder: %VMDIR%
@echo using backup folder: %BAKDIR%
cd /d %VBDIR% >> %BAKDIR%\bak.log


REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
REM SUBSCRIPT: create one per each VM to backup
REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
set MYVM=machine1
REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

set MYSTATUS=0
for /f "delims=" %%A in ('VBoxManage list runningvms^|grep -c %MYVM%') do set "MYSTATUS=%%A"
@echo BACKUP for: %VMDIR%\%MYVM%   -  Current status: %MYSTATUS%
if "%MYSTATUS%"=="1" VBoxManage controlvm %MYVM% savestate >> %BAKDIR%\bak.log
xcopy /D/S/Y %VMDIR%\%MYVM%\*.* %BAKDIR%\%MYVM%\ >> %BAKDIR%\bak.log
if "%MYSTATUS%"=="1" VBoxManage startvm %MYVM% >> %BAKDIR%\bak.log
@echo BACKUP OK >> %BAKDIR%\bak.log


REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
REM SUBSCRIPT: create one per each VM to backup
REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
set MYVM=machine2
REM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

set MYSTATUS=0
for /f "delims=" %%A in ('VBoxManage list runningvms^|grep -c %MYVM%') do set "MYSTATUS=%%A"
@echo BACKUP for: %VMDIR%\%MYVM%   -  Current status: %MYSTATUS%
if "%MYSTATUS%"=="1" VBoxManage controlvm %MYVM% savestate >> %BAKDIR%\bak.log
xcopy /D/S/Y %VMDIR%\%MYVM%\*.* %BAKDIR%\%MYVM%\ >> %BAKDIR%\bak.log
if "%MYSTATUS%"=="1" VBoxManage startvm %MYVM% >> %BAKDIR%\bak.log
@echo BACKUP OK >> %BAKDIR%\bak.log


22 Jul 2008

VMware Server vs VirtualBox vs QEMU

all FREE, all GOOD


Since i used both in many OS, running many OS, the main difference between VirtualBox & VMware is the fact that:

>> if running from a linux box, when you update the kernel, VMW requires a recompilation. VB does not.

so this will affect you only if your main os is linux based, and you plan to update the kernel.
but even this situation is not a big deal, you just have to run a script and wait few minutes.

on the other side, both those software are FREE and works GOOD.
In my experience even on the PERFORMANCE side they're equivalent.
Obviously there are differences, but they vary for each guest os with each configuration.

You can even switch between both system just converting the img file.