I found this really cool open source software that I’m currently implementing for a customer remotely.
It’s called HVBackup and is of the time of writing in Beta v1.
Description from their website:
The main goal of this project is to provide a very easy and powerful free tool to backup and restore Hyper-V virtual machines, in standalone and clustered (CSV) environments, overcoming all the limitations that a generic tool like Diskshadow provides.
This tool targets Windows 2008, Windows 2008 R2 and Windows 8 / Windows Server 2012. All the corresponding core and free Hyper-V editions are also supported!
HVBackup supports app consistent and crash consistent backups through the Hyper V VSS writer component integrated in the operating system.
There are quite a few expensive commercial solutions on the market supporting this scenario, but this is the first open source one, based on the research we did before publishing the project.
We integrated this tool in our datacenter’s production environment management infrastructure, which means that it undergoes continuous testing in a real world environment :-)
HVBackup can be invoked from the command line, scripted with Powershell or integrated in any .Net program through it’s class library.
The backup process generates a separate zip file for each virtual machine in the specified output directory, containing all the files owned by the VM and identified for backup by the VSS Hyper-V provider.
My script for the tool is essentially the same as theirs, only that I’m slightly changing the way files are archived. Check it out below.
@echo off set BCKPATH="\\MYNAS\hvbackup" rem net use %BCKPATH% /user:
rem Move files older than 1 day to %BCKPATH%\Archive from %BCKPATH%\Sync pushd %BCKPATH%\Sync && forfiles.exe -m *.zip -d -1 -c "cmd /c move @path %BCKPATH%\Archive" popd rem Delete files older than 4 days from %BCKPATH%\Archive pushd %BCKPATH%\Archive && forfiles.exe -m *.zip -d -4 -c "cmd /c del @path" popd c:\hvbackup\HVBackup.exe -a -o %BCKPATH%\Sync 1> %BCKPATH%\%computername%_lastlog_out.txt 2> %BCKPATH%\%computername%_lastlog_err.txt && set error=0 || set error=1 :sendmail if ["%error%"] EQU ["1"] ( c:\blat\blat -tf "%BCKPATH%\recipients.txt" -subject "HVBackup encountered errors" -body "See attached log files" -attacht "%BCKPATH%\%computername%_lastlog_out.txt,%BCKPATH%\%computername%_lastlog_err.txt" ) if ["%error%"] EQU ["0"] ( c:\blat\blat -tf "%BCKPATH%\recipients.txt" -subject "HVBackup successfully finished" -body "See attached log files" -attacht "%BCKPATH%\%computername%_lastlog_out.txt,%BCKPATH%\%computername%_lastlog_err.txt" ) goto exit :exit exit /b
The folder “Sync” is actually being synced to a remote NAS, and due to the fact that it is being synced – I only want to include the latest backup.
The other backups from the previous day are being moved to the folder “Archive” and is also being cleaned up when the script is executed.
It saves backups in the Archive folder for 4 days.
I’m using Blat to send emails from the script.
This blog to learn more about Blat
The Official Website of Blat