I have a little problem. after a good year of manually backing up my server, i was thinking about finally getting around to create a bat file to do it for me with a simple double click. Problem is, i cant seem to figure out how.
So first thing i did was to follow these instructions:
Code: Select all
"c:\Program Files\Oracle\VirtualBox\vboxmanage.exe" controlvm UbuntuServer savestate
xcopy "C:\Users\da\VirtualBox VMs\UbuntuServer\*" e:\backup_vm\%date%\* /Y /S
"c:\Program Files\Oracle\VirtualBox\vboxmanage.exe" startvm UbuntuServer
"vboxmanage.exe error code e_fail (0x80004005) - uspecified error (extended info not available)"
"VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 493 of file VBoxManageModifyVM.cpp"
then further down i get
"xcopy "C:\Users\da\VirtualBox VMs\UbuntuServer\*" e:\backup_vm\%date%\* /Y /S"
invalid number of parameters
does anyone have a script i can copy? a simple "save state of machine" -> "copy disk file" -> "continue machine". and if we're really fancy, add a archiving functionality like in this example which again, i cant get to work:
Code: Select all
@ECHO OFF
CLS
SET "VM=Ubuntu Server 14.04"
SET "VM_DIR=C:\VirtualBox VMs\"
SET "BACKUP_DIR=C:\VirtualBox VMs\backup\"
SET VBOXMANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
SET RAR="C:\Program Files\WinRAR\Rar.exe"
SET CICLOS=10
SET PAUSAS=5
SET SOLICITUD_APAGADO=0
SET ERROR=0
SET RUNNING_INICIAL=2
ECHO Starting backup VM "%VM%"...
:check_running
%VBOXMANAGE% list runningvms > %TEMP%\runningvms.txt
FIND "%VM%" %TEMP%\runningvms.txt > nul
IF %errorlevel% EQU 0 (
SET RUNNING=1
) ELSE (
SET RUNNING=0
)
IF %RUNNING_INICIAL% EQU 2 (
SET RUNNING_INICIAL=%RUNNING%
)
IF %CICLOS% GTR 0 (
IF %RUNNING% EQU 1 (
IF %SOLICITUD_APAGADO% EQU 0 (
SET SOLICITUD_APAGADO=1
ECHO Power off VM "%VM%"...
%VBOXMANAGE% controlvm "%VM%" acpipowerbutton
)
ECHO Waiting VM "%VM%" shut down...
TIMEOUT /t %PAUSAS% /nobreak > nul
SET /a CICLOS-=1
GOTO check_running
) ELSE (
ECHO VM "%VM%" is power off now...
)
)
DEL %TEMP%\runningvms.txt
IF %RUNNING% EQU 1 (
SET ERROR=1
GOTO end
)
:copy_vm
ECHO Copying VM "%VM%"...
TIMEOUT /t 3 /nobreak > nul
XCOPY "%VM_DIR%%VM%" "%BACKUP_DIR%%VM%" /E /I /Y
IF %errorlevel% NEQ 0 (
SET ERROR=2
GOTO end
)
:start_vm
IF %RUNNING_INICIAL% EQU 1 (
ECHO Starting VM "%VM%"...
%VBOXMANAGE% startvm "%VM%"
IF %errorlevel% NEQ 0 (
SET ERROR=3
GOTO end
)
)
:compress_backup
ECHO Compressing backup VM "%VM%"...
SET FECHA=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%
%RAR% a -r -ep1 -o+ "%BACKUP_DIR%%VM% %FECHA%.rar" "%BACKUP_DIR%%VM%"
IF %errorlevel% NEQ 0 (
SET ERROR=4
GOTO end
)
:delete_uncompressed_backup
ECHO Removing uncompressed backup VM "%VM%"...
RMDIR "%BACKUP_DIR%%VM%" /S /Q
IF %errorlevel% NEQ 0 (
SET ERROR=5
GOTO end
)
:end
IF %ERROR% GTR 0 (
ECHO Error ^(%ERROR%^) while creating backup VM "%VM%".
) ELSE (
ECHO Backup finished OK.
)
ive also followed this instruction here to little success
https://forums.bunsenlabs.org/viewtopic.php?id=1688
______________________________________________________________________
edit, ok no, there probably is a proper issue somewhere.
I created a simple BAT file to see weather or not im just too stupid to work with these things, but when i did something really simple like this
Code: Select all
cd C:\Program Files\Oracle\VirtualBox
VBoxManage controlvm Iway savestate
cmd /k
i still get
Code: Select all
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Shared)" at line 388 of file VBoxManageControlVM.cpp
returned, so i think there must be something wrong with my installation...
in any event im happy to provide any information needed! thanks a lot!