Well this morning I had the distinct privilege of loosing two disks… YIKES! Thank’s to Raid_DP my Aggregate is still online, but if I loose another disk I’m done. As this is not a comfortable position to be in I want to know how long it will take; enter PowerShell!
Using my PoshOnTap module I wrote a quick script to monitor the status of a rebuild. Hopefully you’ll never need it!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$start = Get-Date $prog = 1 while ($prog -ne 0){ sleep 5 #so we dont DOS the filer $i = 0 $total = 0 write-progress -activity "Reconstructing " -Status " -> " ` -PercentComplete $prog ` -Id $i ` -SecondsRemaining (($prog/((New-TimeSpan -Start $start).seconds)) * (100 - $prog)) Get-NaDisk | Where-Object {$_.raidstate -eq "reconstructing"} | Foreach-Object { $I++ write-progress -activity "reconstructing $($_.Disk) " ` -Status "% Completed: $($_.PercentageComplete) " ` -PercentComplete$_.ReconstructionPercent ` -Id $I ` -ParentId 0 $total += $_.ReconstructionPercent } $prog = ($total/$i) } |
Note: by the time I wrote this the reconstruct was 15% complete, so my seconds remaining is off, but it does correct it self as time progresses.
~Glenn