Skip navigation
VMware

This Question is Answered (go to answer)

2 "helpful" answers available (6 pts)
1,450 Views 12 Replies Last post: Jan 20, 2010 3:26 AM by GeorgeYacubov… RSS
gboskin Hot Shot 223 posts since
Nov 19, 2008
Currently Being Moderated

Jan 6, 2009 12:51 AM

Get RDM size

 

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..????

 

 

LucD Guru User Moderators vExpert 8,981 posts since
Oct 31, 2005
Currently Being Moderated
1. Jan 6, 2009 2:02 AM in response to: gboskin
Re: Get RDM size

You could use the script from  list disks rdm with powershell.

With a minor adaption it will also display the disk capacity.

$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

An RDM is mapped via a .vmdk file.

Through the .vmdk file the size can be obtained.

Blog: http://lucd.info | Twitter: @LucD22 | Book co-author: http://powerclibook.com
LucD Guru User Moderators vExpert 8,981 posts since
Oct 31, 2005
Currently Being Moderated
3. Jan 6, 2009 2:49 AM in response to: gboskin
Re: Get RDM size

Can you attach the script you are using ?

I have no line 30

Blog: http://lucd.info | Twitter: @LucD22 | Book co-author: http://powerclibook.com
LucD Guru User Moderators vExpert 8,981 posts since
Oct 31, 2005
Currently Being Moderated
6. Jan 6, 2009 4:02 AM in response to: gboskin
Re: Get RDM size

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.

Blog: http://lucd.info | Twitter: @LucD22 | Book co-author: http://powerclibook.com
ief Enthusiast 28 posts since
Aug 19, 2005
Currently Being Moderated
8. Jan 6, 2009 5:52 AM in response to: gboskin
Re: Get RDM size

Make sure you are connected to the vc

 

 

 

blog www.ivobeerens.nl

blog www.ivobeerens.nl
GeorgeYacubov… Lurker 2 posts since
Aug 10, 2009
Currently Being Moderated
10. Jan 17, 2010 6:21 AM in response to: gboskin
Re: Get RDM size

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..

c_shanklin Master VMware Employees 943 posts since
Dec 3, 2007
Currently Being Moderated
11. Jan 18, 2010 1:18 PM in response to: GeorgeYacubov…
Re: Get RDM size

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|http://twitter.com/cshanklin]

Carter Shanklin | VMware Product Management | @cshanklin
GeorgeYacubov… Lurker 2 posts since
Aug 10, 2009
Currently Being Moderated
12. Jan 20, 2010 3:26 AM in response to: c_shanklin
Re: Get RDM size

Thank you for the pointer.   If it is what I'm after; great.  If I'm able to tweak it.  I'll post it.

Bookmarked By (0)

Share This Page

Communities