Virtual Disk Repair Times

On S2D Clusters, here is a small code snippet that I find useful to see how Virtual Disk repairs are going after rebooting a node or replacing a disk. It will also attempt to estimate the remaining time left (shout-out to Russell Workman for that addition):

while($true) { Get-VirtualDisk | Sort-Object FriendlyName | ft FriendlyName, OperationalStatus, HealthStatus ; Get-StorageJob | Sort-Object Name | ? { $_.JobState -notlike 'Completed' } 

$jobs = Get-storagejob | ? { $_.Name -like "*repair" -or $_.Name -like "*regeneration" }
$BytesProcessed = ($jobs.BytesProcessed | measure-Object -sum).sum
$BytesTotal = ($jobs.BytesTotal | measure-Object -sum).sum
$runningJobs = $jobs.count
$overallpercent = $BytesProcessed / $BytesTotal
if ($overallpercent -gt 0) 
   {
     $longestElapsedTime = ($jobs.ElapsedTime | select -First 1).TotalSeconds
     $remainingSeconds = ($longestElapsedTime / $overallpercent) - $longestElapsedTime
     $now = Get-Date
     $estimatedFinish = $now.AddSeconds($remainingSeconds)
     write-host "Estimated finish: $estimatedFinish" -foregroundcolor blue
     write-host "Current Time: $now" -foregroundcolor green
   }
else 
   {
     write-host "zero bytes processed, cannot estimate" -foregroundcolor red
   } 

sleep 2 ; Clear-Host }
Post Disclaimer

The information contained in the posts in this blog site is for general information purposes only. The information in this post "Virtual Disk Repair Times" is provided by "Lee Harrison's Technical Blog" and whilst we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Furthermore, it is always recommended that you test any related changes to your environments on non-production systems and always have a robust backup strategy in place.

2 thoughts to “Virtual Disk Repair Times”

Leave a Reply

Your email address will not be published. Required fields are marked *