THIS IS A WINDOWS

exportVMs.cmd

SCRIPT, BUT CAN BE EASILY ADAPTED TO WORK UNDER LINUX:

you will have to make an entry for every vm.

PRINCIPLE:
1. SAVE STATE (PAUSE VM)
2. CLONE TO BACKUP DIRECTORY (preferable on a NAS with a lot of storage… like 5x 2TB RAID5)
3. START VM


REM net use B: \\192.168.0.251\backup /persistent:yes /user:backup password

SET BACKUPDIR=\\192.168.0.251\backup

ECHO "writing current date to variable"
SET DATE=%date:~6,4%-%date:~3,2%-%date:~0,2%

ECHO "going into virtualbox directory so VBoxManage.exe can be reached"
REM cd "C:\Program Files\Oracle\VirtualBox\"

ECHO "===================================="

SET VNAME=NAME_OF_VM1

VBoxManage.exe controlvm "%VNAME%" savestate

VBoxManage.exe clonevm --options keepallmacs "%VNAME%" --name "%DATE%_%VNAME%" --basefolder %BACKUPDIR%

VBoxManage.exe startvm --type headless "%VNAME%"

ECHO "backup of "%VNAME%" FINISHED"

ECHO "===================================="

SET VNAME=NAME_OF_VM2

VBoxManage.exe controlvm "%VNAME%" savestate

VBoxManage.exe clonevm --options keepallmacs "%VNAME%" --name "%DATE%_%VNAME%" --basefolder %BACKUPDIR%

VBoxManage.exe startvm --type headless "%VNAME%"

ECHO "backup of "%VNAME%" FINISHED"

ECHO "===================================="

ECHO "FINISHED"

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin