Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to find the VM file system usage, but only on VMs that have a vmdk on a particular device. The VM host could have storage from multiple devices, for instance EMC and IBM devices. I only want to know the amount of space used by VMs that have storage on an IBM device.

I'm trying to use powercli to find this information, but I can't 'tie' the information together. I'm not a VMWare admin, and so I'm having a hard time finding the correlation (and if my terminology is incorrect, sorry about that.)

I can find only the IBM disks with the following command:

Get-VMHost <host> | Get-VMHostHba -type FibreChannel | Get-ScsiLun -CanonicalName eui* -LunType disk

I can also get the file system usage with the following:

$AllVMs = Get-VMHost <host> | Get-VM
ForEach ($VM in $AllVMs) {

    $Views = $VM | Get-View
    ForEach ($View in $Views) {

        Foreach ($Disk in $View.Guest.Disk) {

            $disk.DiskPath
            ([math]::Round($disk.Capacity/ 1MB))
            ([math]::Round($disk.FreeSpace / 1MB))
        }
    }
}

However, how can I be sure that c:\ on host1 is on an IBM array and not an EMC array?

share|improve this question
add comment

2 Answers

The connection you're looking for is the datastore; each LUN on the IBM SAN is formatted into a "datastore" by VMware for storage of virtual hard disks.

Unfortunately, the DiskInfo object that you're ending up with has no information about which datastore it resides on.. which is kinda weak in my opinion.

I don't have a system with PowerCLI installed on to test this on right this second, but instead of enumerating Guest.Disk, try the HardDisk property on the object returned by Get-VM. Its Filename property should give you some indication of which datastore it resides on, even if it's just a unique ID.

share|improve this answer
    
Thanks for this information, using this I was able to find the link to the answer. –  Joel Apr 21 '11 at 21:09
add comment
up vote 0 down vote accepted

I was able to find the answer to this at the following link:

http://communities.vmware.com/thread/240466

From there, I was able to tie the VMHost and disk to the VM and the Guest information.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.