PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 821
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

FastClone on ReFS repository

Post by matteu »

Hello,

Is there a way to find Fastclone is used on Windows (refs) repository ?
I don't find anything on the get-vbrbackuprepository command

Thanks
ronnmartin61
Veeam Software
Posts: 537
Liked: 191 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: FastClone on ReFS repository

Post by ronnmartin61 »

Do you mean you want to be able to detect if fast cloning is possible on the repo or if it in fact is actively being used? Assuming the latter but since this is ultimately backup job setting dependent would imagine it's not an attribute of the repository. If the "Used Space" is > "Capacity" - "Free" I think it might be a safe assumption that block cloning is active. There may be corner cases I'm not thinking of though...
Gostev
Chief Product Officer
Posts: 31804
Liked: 7298 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: FastClone on ReFS repository

Post by Gostev »

If fast clone is used, then you will see the corresponding tag next to fast-clone-able operation (like synthetic full) in the job action log.
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: FastClone on ReFS repository

Post by david.domask »

Hey @matteau

Try these; I use them for a script the engineers use for troubleshooting fast clone issues. You can use the first few functions to get repository info, and pass that to the last function:

Code: Select all

function Get-WindowsRepositoryInfo {
    param(
        [string[]]$RepositoryID
        )
		$WinRepositoryInfo = [Veeam.Backup.Core.CWindowsRepository]::FindByRepository("$RepositoryID")
		return $WinRepositoryInfo
	}
	
function Get-LinuxRepositoryInfo {
    param(
        [string[]]$RepositoryID
        )
		$LinuxRepositoryInfo = [Veeam.Backup.Core.CLinuxRepository]::FindByRepository("$RepositoryID") 
		return $LinuxRepositoryInfo
	}

function Get-CIFSRepositoryInfo {
	param(
		[string[]]$RepositoryID
		)
		$CIFSRepositoryInfo = [Veeam.Backup.Core.CCifsRepository]::FindByRepository("$RepositoryID") 
		return $CIFSRepositoryInfo
	}

function Get-RepositoryTypeAndInfo {
	param(
		[Object[]]$RepositoryToCheck
	)
	If($RepositoryToCheck.Type -eq "LinuxLocal"){
		$RepoInfo = Get-LinuxRepositoryInfo -RepositoryID $RepositoryToCheck.id
	} elseif ($RepositoryToCheck.Type -eq "CifsShare") {
		$RepoInfo = Get-CIFSRepositoryInfo -RepositoryID $RepositoryToCheck.id
	} elseif ($RepositoryToCheck.Type -eq "WinLocal"){
		$RepoInfo = Get-WindowsRepositoryInfo -RepositoryID $RepositoryToCheck.id
	}
	$RepositoryData += (Show-IsFastClonePossibleandClusterSize -BackupRepositoryInfo $RepoInfo)
	return	$RepositoryData
} 	


function Show-IsFastClonePossibleandClusterSize {
	param(
		[Object[]]$BackupRepositoryInfo
		)
		$RepositoryInformation = [ordered]@{
			RepositoryName = $RepositoryToCheck.Name
			RepositoryType = $RepositoryToCheck.Type
			FastClonePossible = ($BackupRepositoryInfo.IsVirtualSyntheticEnabled -and $BackupRepositoryInfo.IsVirtualSyntheticAvailable)
			RepoClusterSize = $BackupRepositoryInfo.ClusterSize
			IsDedupEnabledWinOnly = $BackupRepositoryInfo.IsDedupEnabled
		}
		return $RepositoryInformation
	}
Note I do something a bit dirty here in the last method (it was due to inexperience at the time...same with the strings for the first functions) and I rely on the $RepositoryToCheck variable being live in memory. You'll call Get-RepositoryTypeAndInfo and save the return value, then pass that to Show-IsFastClonePossibleandClusterSize. The first 3 functions are needed to make the Get-RepositoryTypeAndInfo function work.
David Domask | Product Management: Principal Analyst
matteu
Veeam Legend
Posts: 821
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: FastClone on ReFS repository

Post by matteu » 1 person likes this post

Hello,

Thanks for your answer.

This is my result with your help :

Code: Select all

$RepositoryReq = Get-VBRBackupRepository
foreach ($element in $RepositoryReq)
{
    #FastClone windows
    $FastCloneWin=[Veeam.Backup.Core.CWindowsRepository]::FindByRepository($element.id).IsRefsSyntheticAvailable -and [Veeam.Backup.Core.CWindowsRepository]::FindByRepository($element.id).IsRefsSyntheticEnabled
    #FastClone linux
    $FastCloneLin=[Veeam.Backup.Core.CLinuxRepository]::FindByRepository($element.id).IsVirtualSyntheticAvailable -and [Veeam.Backup.Core.CLinuxRepository]::FindByRepository($element.id).IsVirtualSyntheticEnabled


    [pscustomobject]@{
        Name = $element.name
        FastClone = $FastCloneWin -or $FastCloneLin
    }
}
And my entire function :

Code: Select all

function Get-VeeamRepository
{
    Write-host "Repository"
    $RepositoryReq = Get-VBRBackupRepository
    foreach ($element in $RepositoryReq)
    {
        $Server = Get-VBRServer | Where-Object {$_.id -eq $element.HostId}
        $gateway = "<N/A>"  
        $credentials = "<N/A>"  
        $Immutability = "<N/A>" 
        $hostname = "<N/A>" 

        if ($null -ne $Server) 
        {
            $hostname = $Server.name.split(".")[0]
        }
        $gateway =  if ($element.HostId.guid -eq "00000000-0000-0000-0000-000000000000") 
                    {
                        "AutoSelect"
                    } 
                    else 
                    {
                        $req=(Get-VBRServer | Where-Object {$_.id -eq (Get-VBRBackupRepository -name $element.name).hostid}).name
                        if($req -ne $element.Host.name)
                        {
                            $req
                        }
                    }
        $credentials = if( $element.TypeDisplay -eq "SMB") {(Get-VBRCredentials | Where-Object {$_.id -eq (Get-VBRBackupRepository -name $element.name).ShareCredsId.guid}).name}
        #FastClone windows
        $FastCloneWin=[Veeam.Backup.Core.CWindowsRepository]::FindByRepository($element.id).IsRefsSyntheticAvailable -and [Veeam.Backup.Core.CWindowsRepository]::FindByRepository($element.id).IsRefsSyntheticEnabled
        #FastClone linux
        $FastCloneLin=[Veeam.Backup.Core.CLinuxRepository]::FindByRepository($element.id).IsVirtualSyntheticAvailable -and [Veeam.Backup.Core.CLinuxRepository]::FindByRepository($element.id).IsVirtualSyntheticEnabled

        $Immutability = if ($element.GetImmutabilitySettings().IsEnabled -eq $true)
        {
            $element.GetImmutabilitySettings().intervaldays
        }

        [pscustomobject]@{
            Name = $element.name
            Host = $hostname
            Path = $element.Friendlypath
            Type = $element.Type
            Capacity = $element.GetContainer().CachedTotalSpace.InBytes / 1GB -as [int]
            FreeSpace = $element.GetContainer().CachedFreeSpace.InBytes / 1GB -as [int]
            Credentials = $credentials
            Gateway = $gateway
            MaxTasks = $element.Options.MaxTaskCount
            "DataRate(MB/s)" = $element.Options.CombinedDataRateLimit
            ProxyAffinityAutoDetect = $element.Options.IsAutoDetectAffinityProxies
            UseNfs =  $element.UseNfsOnMountHost
            MountServer = (Get-VBRServer | Where-Object {$_.id -eq $element.MountHostId}).name
            RotatedDriveRepository = $element.IsRotatedDriveRepository
            PerVmChain = $element.Options.OneBackupFilePerVm
            Uncompress = $element.Options.uncompress
            OptimizeBlockAlign = $element.Options.OptimizeBlockAlign
            FastClone = $FastCloneWin -or $FastCloneLin
            Immutability = $Immutability
        }
    }
    Write-host "-------------------"
}

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests