NOTE: This is not an official script from TINTRI
In Tintri storage systems, the “SyncVDisk” operation refers to the process of synchronizing a virtual disk (vDisk) with its corresponding snapshot on the Tintri storage. The Tintri PowerShell Toolkit provides a set of cmdlets that can be used to manage and monitor Tintri storage, including operations like syncing vDisks. Below is a PowerShell script using the Tintri PowerShell Toolkit to perform the “SyncVDisk” operation:
# Install the Tintri PowerShell Toolkit (if not already installed)
# Instructions to install the toolkit can be found on the Tintri Support Portal
# Import the Tintri PowerShell Toolkit module
Import-Module -Name "Tintri.Powershell"
# Connect to the Tintri storage system
$TintriServer = "Tintri-IP-Address"
$Credential = Get-Credential
Connect-TintriServer -Server $TintriServer -Credential $Credential
# Specify the vDisk name for which you want to perform the SyncVDisk operation
$vDiskName = "Name_of_vDisk"
# Get the vDisk object from Tintri storage
$vDisk = Get-TintriVdisk | Where-Object { $_.Name -eq $vDiskName }
# Check if the vDisk exists
if ($vDisk) {
# Perform the SyncVDisk operation
Sync-TintriVdisk -VdiskId $vDisk.VdiskId
# Wait for the operation to complete (optional)
# By default, the Sync-TintriVdisk cmdlet waits for the operation to complete. You can add -NoWait parameter to avoid waiting.
# Check the status of the SyncVDisk operation
$vDiskAfterSync = Get-TintriVdisk | Where-Object { $_.Name -eq $vDiskName }
if ($vDiskAfterSync.SyncProgress -eq "100.00 %") {
Write-Host "SyncVDisk operation completed successfully."
} else {
Write-Host "SyncVDisk operation did not complete successfully. Sync progress: $($vDiskAfterSync.SyncProgress)"
}
} else {
Write-Host "vDisk '$vDiskName' not found on Tintri storage."
}
# Disconnect from the Tintri storage system
Disconnect-TintriServer
Explanation:
- Install the Tintri PowerShell Toolkit if you haven’t already. You can find the toolkit on the Tintri Support Portal.
- Import the Tintri PowerShell Toolkit module into the script.
- Connect to the Tintri storage system using the
Connect-TintriServercmdlet, providing the Tintri storage IP address and user credentials. - Set the
$vDiskNamevariable to the name of the vDisk that you want to sync. - Use the
Get-TintriVdiskcmdlet to retrieve the vDisk object from the Tintri storage system. - Check if the vDisk exists. If it does, perform the “SyncVDisk” operation using the
Sync-TintriVdiskcmdlet and passing the vDisk ID as a parameter. - Optionally, you can wait for the operation to complete using the
-NoWaitparameter if you don’t want to wait for the operation to finish. - After the operation completes, use
Get-TintriVdiskagain to check the sync progress of the vDisk. - Based on the sync progress, display a message indicating whether the “SyncVDisk” operation completed successfully or not.
- Finally, disconnect from the Tintri storage using the
Disconnect-TintriServercmdlet.
Make sure to replace “Tintri-IP-Address” with the actual IP address of your Tintri storage system. Also, replace “Name_of_vDisk” with the name of the vDisk you want to sync. Always test scripts in a non-production environment before using them in production to ensure they behave as expected.