{"id":1145,"date":"2019-11-16T19:29:06","date_gmt":"2019-11-16T17:29:06","guid":{"rendered":"http:\/\/www.ctlab.gr\/?p=1145"},"modified":"2019-11-21T00:01:48","modified_gmt":"2019-11-20T22:01:48","slug":"view-storage-spaces-direct-s2d-slabs-placement-statistics","status":"publish","type":"post","link":"https:\/\/www.ctlab.gr\/?p=1145","title":{"rendered":"View Storage Spaces Direct (S2D) slabs placement statistics"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ctlab.gr\/wp-content\/uploads\/2019\/11\/PowerShell_logo.png\" alt=\"\" class=\"wp-image-1168\" width=\"128\" height=\"128\" srcset=\"https:\/\/www.ctlab.gr\/wp-content\/uploads\/2019\/11\/PowerShell_logo.png 256w, https:\/\/www.ctlab.gr\/wp-content\/uploads\/2019\/11\/PowerShell_logo-150x150.png 150w\" sizes=\"auto, (max-width: 128px) 100vw, 128px\" \/><\/figure><\/div>\n\n\n\n<p>Recently, I was dealing with an HCI cluster and I needed to see how the slabs (or extents, if you prefer) are placed on each disk. Since there is no such direct PowerShell command to visualize this information, I ended up writing a small function that serves this purpose. The function performs some queries on the virtual disk to find the slubs, calculate the statistics and correlate with the hosts that hold each disk. In the end, it groups the results and returns them in a single table.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>I use only Get commands, so apart from a slight stress in the storage I\/O you should not expect any issues. However, as always, be aware that I hold no responsibility on any problems caused by this code and you should always use it at your own risk.<\/p>\n\n\n\n<p>I hope you enjoy it! If you do, please feel free to share your thoughts leaving a comment. I would also love to read any improvements.<\/p>\n\n\n<pre class=\"brush: powershell; title: GetCTL-VirtualDiskSlabs.ps1; notranslate\" title=\"GetCTL-VirtualDiskSlabs.ps1\">\nFunction GetCTL-VirtualDiskSlabs {\n&amp;lt;#\n.SYNOPSIS\n    View physical disks and virtual disks' extents (aka slabs) correlation.\n\tCreated by Lefteris Mourikis (Nov 2019)\n#&amp;gt;\n\n    Param (\n        &#x5B;Parameter(Mandatory=$True)]\n        &#x5B;string]$VirtualDiskName\n\n        #&#x5B;Parameter(Mandatory=$False)]\n        #&#x5B;ValidateSet('Alpha','Beta','Gamma')]\n    )\n\n    Begin {\n        # Start of the BEGIN block.\n\t\t#$CtlVirtualDisk = $(Get-VirtualDisk -FriendlyName $VirtualDiskName | select *)\n\t\t$CtlPhysicalExtents = $(Get-VirtualDisk -FriendlyName $VirtualDiskName | Get-PhysicalExtent | select *)\n\t\t\n\t\t##$CtlPysicalExtentsCount = $($CtlPhysicalExtents | Measure).Count\n\n\t\t\n\t\t$CtlResultTmp = $CtlPhysicalExtents.PhysicalDiskUniqueId | Get-PhysicalDisk | `\n\t\t\tselect @{Name=&quot;DiskUniqueID&quot;;Expression={$_.UniqueID}}, @{Name=&quot;DiskSerialNumber&quot;;Expression={$_.SerialNumber}}, `\n\t\t\tOperationalStatus, HealthStatus, Usage, `\n\t\t\t@{Name=&quot;HostName&quot;;Expression={$(Get-StorageNode -PhysicalDisk $(Get-PhysicalDisk -UniqueId $_.UniqueId) -PhysicallyConnected)&#x5B;0].Name}}\n\n\t\t$CtlResult = $CtlResultTmp | select *, @{Name=&quot;ExtentsCount&quot;;Expression={$($CtlResultTmp | ? DiskUniqueID -eq $_.DiskUniqueID | Measure).Count}} `\n\t\t\t| Sort-Object -Property DiskUniqueID -Unique | Sort-Object -Property HostName\n\t\t\n    } # End Begin block\n\n    Process {\n        # Start of PROCESS block.\n\n\n    } # End of PROCESS block.\n\n    End {\n        # Start of END block.\n\t\t$CtlResult | ft *\n        ##Write-Host &quot;Total number of slabs: $CtlPysicalExtentsCount&quot;\n\t\t\n    } # End of the END Block.\n} # End Function\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I was dealing with an HCI cluster and I needed to see how the slabs (or extents, if you prefer) are placed on each disk. Since there is no such direct PowerShell command to visualize this information, I ended up writing a small function that serves this purpose. The function performs some queries on &hellip; <a href=\"https:\/\/www.ctlab.gr\/?p=1145\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">View Storage Spaces Direct (S2D) slabs placement statistics<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[92,72,90,91],"class_list":["post-1145","post","type-post","status-publish","format-standard","hentry","category-articles","tag-hci","tag-powershell","tag-s2d","tag-storage-spaces-direct"],"_links":{"self":[{"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=\/wp\/v2\/posts\/1145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1145"}],"version-history":[{"count":32,"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=\/wp\/v2\/posts\/1145\/revisions"}],"predecessor-version":[{"id":1180,"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=\/wp\/v2\/posts\/1145\/revisions\/1180"}],"wp:attachment":[{"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ctlab.gr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}