SOLVED!! Backup Differencing Disks in Veeam

Hyper-V specific discussions

SOLVED!! Backup Differencing Disks in Veeam

Veeam Logoby robertd0275 » Thu Jul 11, 2013 3:29 pm 1 person likes this post

This is in Ref to Veeam Support - Case # 00260743

I contacted Veeam Tech support with questions on how to successfully backup a VM with a differencing disk. To my surprise, I only found ONE forum post here that even mentioned it.
The User got an error stating "Error: VHD extents can not be in different folders." This got me thinking.. Support replied that is was not supported, but gave no explanation. So I looked at it myself. There is only ONE WAY this can be done without the backups failing. Here it is: I use the script below (launched as a .ps1 file) to make between 1 and infinite VMs. All have Differencing disks pointing to ONE master VHDX. All successfully backup in Veeam EVERY TIME!

I will explain how it works and then post the code. First, Create a new folder on C:\ called "Deploy" or whatever is easy for you. Next, you create a .txt file called "list.txt" and save it to that folder. Third, copy the code below and paste it into notepad and save as "DiffVM.ps1" or what ever is easy for you. Now you have all the pieces in place. You ONLY HAVE TO CHANGE ITEMS IN THE VARIABLES PORTION OF MY SCRIPT BELOW, don NOT change anything else or you will break it or cause the end result to not backup!!

#EXAMPLE EXPLAINED. Below are the ONLY things you need to change:

$list = "list.txt" This is the file you make. only enter the new VM names here. like TEST (then hit enter) Test2 (then hit enter)
$computers = get-content $list #grab the names of the servers/computers to check from the list.txt file.
$Path = "C:\Some Path" This is the path for the NEW FOLDER to store all your Differencing VMs
$ParentPath = "X:\Some Path To Your Original VM Disk" EX."L:\VMTemplates\DIFFERENCING_MASTER_DISKS"
$VHDXName = "SRV2012Master" #The name of the file to look for. DO NOT USE THE EXTENSION, JUST THE NAME
$Switch = "FrontSideTeamSwitch" #Name of the Hyper-V VM Switch to use for internet on that VM
$startmemory = 512MB #How much startup memory to give the VM
$maxmemory = 4GB #How much MAX memory to give the VM
$processor = 2 #How many processors to give the VM

After that is all set, the script looks for your new folder and creates it if it needs to. It then looks at the master disk in it's original spot and copies it to the folder if it isn't already there. Then it will loop through the list.txt file and create a new VM for each name in the list and make it High-Available (optional, this can be deleted if you are not on a cluster or want to run locally). BELOW IS THE FULL SCRIPT< COPY THAT >

######FULL SCRIPT STARTS HERE
##############################################Variables###############################################################
$list = "list.txt"
$computers = get-content $list #grab the names of the servers/computers to check from the list.txt file.
$Path = "C:\Some Path"
$ParentPath = "L:\VMTemplates\DIFFERENCING_MASTER_DISKS"
$VHDXName = "SRV2012Master"
$Switch = "FrontSideTeamSwitch"
$startmemory = 512MB
$maxmemory = 4GB
$processor = 2

##############################################End Variables###########################################################

##############################################Folder Path Verification################################################
if (Test-Path $Path) {
Write-Host "Folder: The Destination $Path Already Exists" -ForeGroundColor Yellow
} else {
Write-Host "Creating Your New Destination At $Path" -Foregroundcolor Green
New-Item -Path $Path -type directory | Out-Null
}

if (Test-Path $Path\$VHDXName.vhdx) {
Write-Host "$VHDXName.vhdx Already Exists At $Path" -ForeGroundColor Yellow
} else {
Write-Host "Copying $VHDXName.vhdx to $Path" -Foregroundcolor Green
Copy-Item $ParentPath\$VHDXName.vhdx -Destination $Path
}

###############################################End Folder Path Verification###########################################

foreach ($computer in $computers) {

New-VHD –Path "$Path\$computer.vhdx" –ParentPath "$Path\$VHDXName.vhdx" –Differencing
NEW-VM $computer -Path "$Path" -MemoryStartupBytes $startmemory -SwitchName $Switch -BootDevice cd
Add-VMHardDiskDrive -VMName $computer -Path "$Path\$computer.vhdx" –ControllerType IDE -ControllerNumber 0 -ControllerLocation 0
Set-VMMemory $computer -DynamicMemoryEnabled $True -MaximumBytes $maxmemory -MinimumBytes $startmemory -Buffer 5
Set-VMProcessor $computer -Count $processor -Reserve 10 -Maximum 75 -RelativeWeight 200
Set-VMProcessor $computer -CompatibilityForMigrationEnabled $true
Set-VMBios $computer -EnableNumLock
Add-ClusterVirtualMachineRole -VirtualMachine $computer -Name $computer

}
###############################################END CODE###############################################################
robertd0275
Novice
 
Posts: 3
Liked: 3 times
Joined: Thu Jul 11, 2013 3:03 pm
Full Name: Robert Downey

Re: SOLVED!! Backup Differencing Disks in Veeam

Veeam Logoby Vitaliy S. » Thu Jul 11, 2013 9:29 pm

Robert, thanks for sharing this knowledge with the community!
Vitaliy S.
Veeam Software
 
Posts: 19558
Liked: 1102 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov


Return to Microsoft Hyper-V



Who is online

Users browsing this forum: No registered users and 8 guests