Hi All
I am trying to automate creation of new RDM disks for VMs.
We are keeping rdm mapping files separately on a designated datastore, below is the sequence of the commands.
1. Since I can't find PoweCLI method to create the RDM mapping file , I am using vmkfs as below:
vmkfstools -z /vfms/devices/disks/naa.XXXX01 /vmfs/volumes/clustername/SharedDisk/hostname/disk1.vmdk
2. Now we have rdm mapping file, I would like to create a new Physical RDM disk.
New-HardDisk -Contorller $controller -DiskType RawPhysical -DeviceName "/vfms/devices/disks/naa.XXXX01" -vm $vm
This however , creates a new mapping file. I can't see how I can use the one I created above.
Am I missing something? The operation of attaching RDM using existing mapping file is trivial in GUI.
No, you're not missing anything.
That scenario is not possible with New-Harddisk cmdlet I'm afraid.
You could use a script that uses the ReconfigVM method.
Via the Device.Backing property you can specify the location of the VMDK file
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I assume you mean the header file ?
When you pass a LUN to the New-Harddisk cmdlet via the DeviceName parameter, the header file (VMDK file) will be created.
If there is already a header file, you need to use the DiskPath parameter on the New-Harddisk cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you
It seems that DiskType and DiskPath parameters can't be used at the same time
New-HardDisk [-AdvancedOption <AdvancedOption[]>] [[-Persistence] <String>] [-Controller <ScsiController>] [[-DiskType] <DiskType>] ...................
New-HardDisk [[-Persistence] <String>] [-Controller <ScsiController>] -DiskPath <String> .............
That is correct, those parameters belong to different parametersets.
In your case, I would let the header file be created by the New-Harddisk cmdlet, and use the DiskType and DeviceName parameters
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you
I am trying to understand how this would work.
Does it mean I will need to run the cmdlet twice, once for creating header file and then for the disk itself?
No, just once.
You pass the LUN canonicalname to the DeviceName parameter, the cmdlet will create the vdisk, and that call will automatically create the header file (the actual .vmdk file) that points to the LUN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you!
My concern is that header file will be created in the default location .
What I am looking for is to create mapper file in specified folder, i.e. /vmfs/volumes/clustername/SharedDisk/hostname/disk1.vmdk and use this file for attaching raw file to VM.
For example, using GUI I can do following:
1. Create folder /vmfs/volumes/MS_failover_cluster/SharedDisk/MS_failover_clusternode
2. using vmfstools binary, create header file /vmfs/volumes/MS_failover_cluster/SharedDisk/MS_failover_clusternode/disk1.vmdk
3. Add disk to the VM by selecting 'use existing virtual disk ' option , then browsing to the header file above.
I don't seem to be able to do the same using New-Harddisk cmldet.
Am I missing something?
No, you're not missing anything.
That scenario is not possible with New-Harddisk cmdlet I'm afraid.
You could use a script that uses the ReconfigVM method.
Via the Device.Backing property you can specify the location of the VMDK file
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I see.
Thank you very much for your help.
I will give ReconfigVM a go next time I need to have it done.
Thank you again for all your help, highly appreciated.