VMware

This Question is Answered

2 "helpful" answers available (6 pts)
12 Replies Last post: Jan 20, 2010 3:26 AM by GeorgeYacubov…  

Get RDM size posted: Jan 6, 2009 12:51 AM

Click to view gboskin's profile Hot Shot 206 posts since
Nov 19, 2008

Hi all and a happy new year to evryone..

The Following script gives a good list of all the RDM ..

$report1 = @()

$vms = Get-VM |Sort Name -Descending | Get-View

foreach($vm in $vms){

foreach($dev in $vm.Config.Hardware.Device){

if(($dev.gettype()).Name -eq "VirtualDisk"){

*if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or *

($dev.Backing.CompatibilityMode -eq "virtualMode")){

$row = "" | select VMName, HDDeviceName, HDFileName, HDMode

$row.VMName = $vm.Name

$row.HDDeviceName = $dev.Backing.DeviceName

$row.HDFileName = $dev.Backing.FileName

$row.HDMode = $dev.Backing.CompatibilityMode

+$report1 = $row

}

}

}

}

$report1 | ConvertTo-Html -title "Virtual Machine information" -body "<H2>RDM information.</H2>" -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation


is there a way i can get the actual size (capacity) of the RDms..????

Re: Get RDM size

1. Jan 6, 2009 2:02 AM in response to: gboskin
Click to view LucD's profile Champion vExpert 2,851 posts since
Oct 31, 2005
You could use the script from list disks rdm with powershell.
With a minor adaption it will also display the disk capacity.
{noformat}
$report = @()
$vms = Get-VM  | Get-View
foreach($vm in $vms){
  foreach($dev in $vm.Config.Hardware.Device){
    if(($dev.gettype()).Name -eq "VirtualDisk"){
	  if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or 
	     ($dev.Backing.CompatibilityMode -eq "virtualMode")){
	    $row = "" | select VMName, HDDeviceName, HDFileName, HDMode, HDsize
          $row.VMName = $vm.Name
	    $row.HDDeviceName = $dev.Backing.DeviceName
	    $row.HDFileName = $dev.Backing.FileName
	    $row.HDMode = $dev.Backing.CompatibilityMode
           $row.HDSize = $dev.CapacityInKB
	    $report += $row
	  }
	}
  }
}
$report
{noformat}

An RDM is mapped via a .vmdk file.
Through the .vmdk file the size can be obtained.

Re: Get RDM size

3. Jan 6, 2009 2:49 AM in response to: gboskin
Click to view LucD's profile Champion vExpert 2,851 posts since
Oct 31, 2005
Can you attach the script you are using ?
I have no line 30 :-(

Re: Get RDM size

6. Jan 6, 2009 4:02 AM in response to: gboskin
Click to view LucD's profile Champion vExpert 2,851 posts since
Oct 31, 2005
Are you running the samve VC version on both ?
Different versions use different APIs.
It could be that one VC doesn't support all the objects.

Re: Get RDM size

8. Jan 6, 2009 5:52 AM in response to: gboskin
Click to view ief's profile Enthusiast 28 posts since
Aug 19, 2005
Make sure you are connected to the vc


blog www.ivobeerens.nl

Re: Get RDM size

10. Jan 17, 2010 6:21 AM in response to: gboskin
Click to view GeorgeYacubovich's profile Lurker 2 posts since
Aug 10, 2009
Did you figure out?

I am searching for how to monitor and report the details RDM disks on important VMs (i.e. the physical disk RDMs without logical disk letters that are associated wiht Exchange 2007 Storage Groups)

I would like to be able to report on free space remaining.

Thanks in advance..

Re: Get RDM size

11. Jan 18, 2010 1:18 PM in response to: GeorgeYacubov…
Click to view c_shanklin's profile Master VMware Employees 830 posts since
Dec 3, 2007
What you're asking for is a bit more than what I see above.

Check out this script from Hugo Peeters. He mixes PowerCLI with WMI calls to fill in guest information. I assume it will work for volumes without drive letters but if not I bet you can tweak it slightly to what you need.

=====
Carter Shanklin
Read the PowerCLI Blog
Follow me on Twitter

Re: Get RDM size

12. Jan 20, 2010 3:26 AM in response to: c_shanklin
Click to view GeorgeYacubovich's profile Lurker 2 posts since
Aug 10, 2009
Thank you for the pointer. If it is what I'm after; great. If I'm able to tweak it. I'll post it.

VMware Beta Programs

Want to be Considered for Future Beta Programs?

Learn More

VMware Developer

Download SDKs, APIs, videos,
training, and more in the Developer community.

Learn More

Developer
Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld
Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

Only VMware ... Delivers Nexus 1000V

Ensure consistent, policy-based network capabilities to virtual machines across your data center.

Learn More

Communities