{"id":3972,"date":"2019-03-22T16:41:09","date_gmt":"2019-03-22T21:41:09","guid":{"rendered":"http:\/\/www.jasemccarty.com\/blog\/?p=3972"},"modified":"2020-02-16T16:41:29","modified_gmt":"2020-02-16T22:41:29","slug":"vsan-snippets-reporting-drive-location","status":"publish","type":"post","link":"https:\/\/www.jasemccarty.com\/blog\/vsan-snippets-reporting-drive-location\/","title":{"rendered":"vSAN Snippets: Reporting Drive Location &amp; More"},"content":{"rendered":"<p>An internal request came up asking for the ability to return the enclosure location of a vSAN disk.<\/p>\n<p>This information can sometimes be returned from the esxcli command utility, for some storage controllers, using the following command:<\/p>\n<blockquote>\n<p>esxcli storage core device physical get -d &lt;device id&gt;<\/p>\n<\/blockquote>\n<p>The resulting output looks something like this:<\/p>\n<p><a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/enclosure.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16038\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/enclosure.png\" alt=\"\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/enclosure.png 817w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/enclosure-220x93.png 220w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/enclosure-768x324.png 768w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/enclosure-290x122.png 290w\" sizes=\"(max-width: 817px) 100vw, 817px\" \/><\/a><\/p>\n<p>Having to perform that command for a large number of disks could take a significant amount of time and could be quite burdensome.<\/p>\n<p>In the vSphere Client, this information is displayed <strong>Cluster &gt; Configure &gt; vSAN &gt; Disk Management<\/strong> section, choosing to show disks <strong>By Disk Vendors<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/clientlocation.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-16042\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/clientlocation-1024x283.png\" alt=\"\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/clientlocation-1024x283.png 1024w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/clientlocation-220x61.png 220w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/clientlocation-768x212.png 768w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/clientlocation-290x80.png 290w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p><strong>But what if we want to programmatically report this information from PowerCLI?<\/strong><\/p>\n<p>PowerCLI can already report the storage devices on an ESXi host host using the<strong> Get-ScsiLun<\/strong> cmdlet. A significant amount of information is returned from the Get-ScsiLun cmdlet such as the Adapter the disk is attached to, whether the disk is an SSD, if it is eligible for vSAN and more. Unfortunately though, this cmdlet does not report the &#8220;Physical Location&#8221; property.<\/p>\n<p>By combining the <strong>Get-ScsiLun<\/strong> cmdlet, as well as using the power of <strong>Get-EsxCli<\/strong> (<a href=\"https:\/\/blogs.vmware.com\/PowerCLI\/2016\/04\/powercli-6-3-r1-get-esxcli-why-the-v2.html\" target=\"_blank\" rel=\"noopener noreferrer\">version 2 of course<\/a>), this information can be put together to create a quick and easy report for all the hosts in a cluster.<\/p>\n<p><a href=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-16044\" src=\"http:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation-940x1024.png\" alt=\"\" srcset=\"https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation-940x1024.png 940w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation-156x170.png 156w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation-768x837.png 768w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation-174x190.png 174w, https:\/\/blogs.vmware.com\/virtualblocks\/files\/2019\/03\/physdisklocation.png 1114w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/a><\/p>\n<p>This script can be found here: <a href=\"https:\/\/code.vmware.com\/samples\/5539\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/code.vmware.com\/samples\/5539<\/a><\/p>\n<p>Reporting scripts like this, and more, can be found on the <a href=\"https:\/\/code.vmware.com\/samples\" target=\"_blank\" rel=\"noopener noreferrer\">VMware Code<\/a> site and in the <a href=\"https:\/\/storagehub.vmware.com\/section-assets\/powercli-cookbook-for-vsan\" target=\"_blank\" rel=\"noopener noreferrer\">PowerCLI Cookbook for vSAN<\/a>.<\/p>\n<p>This was originally posted on the VMware Virtual Blocks site: https:\/\/blogs.vmware.com\/virtualblocks\/2019\/03\/22\/vsan-snippets-reporting-drive-location\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An internal request came up asking for the ability to return the enclosure location of a vSAN disk. This information can sometimes be returned from &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3972","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/3972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/comments?post=3972"}],"version-history":[{"count":2,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/3972\/revisions"}],"predecessor-version":[{"id":3974,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/posts\/3972\/revisions\/3974"}],"wp:attachment":[{"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/media?parent=3972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/categories?post=3972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jasemccarty.com\/blog\/wp-json\/wp\/v2\/tags?post=3972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}