SyncVDisk operation

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:

  1. Install the Tintri PowerShell Toolkit if you haven’t already. You can find the toolkit on the Tintri Support Portal.
  2. Import the Tintri PowerShell Toolkit module into the script.
  3. Connect to the Tintri storage system using the Connect-TintriServer cmdlet, providing the Tintri storage IP address and user credentials.
  4. Set the $vDiskName variable to the name of the vDisk that you want to sync.
  5. Use the Get-TintriVdisk cmdlet to retrieve the vDisk object from the Tintri storage system.
  6. Check if the vDisk exists. If it does, perform the “SyncVDisk” operation using the Sync-TintriVdisk cmdlet and passing the vDisk ID as a parameter.
  7. Optionally, you can wait for the operation to complete using the -NoWait parameter if you don’t want to wait for the operation to finish.
  8. After the operation completes, use Get-TintriVdisk again to check the sync progress of the vDisk.
  9. Based on the sync progress, display a message indicating whether the “SyncVDisk” operation completed successfully or not.
  10. Finally, disconnect from the Tintri storage using the Disconnect-TintriServer cmdlet.

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.

Leave a comment