VMware Cloud Community
CODETL19
Enthusiast
Enthusiast

Adding RDM Disks to first VM New-HardDisk Incompatible device backing specified for device '0'

Hi,

When using the New-HardDisk cmdlet in an attempt to map an RDM disk to a VM, it fails with the below error:

- "Incompatible device backing specified for device '0'."

I have mapped a disk from an external IBM storage unit to he ESXI hosts. The disk shows on the ESXI hosts in the cluster.

Here is an example of my script:

[hashtable]$unassignedDisks = @{
    1Disk = "naa.600507681081001BA8000000000006FC";
    2Disk = "naa.600507681081001BA8000000000006F8";
    3Disk = "naa.600507681081001BA8000000000006F9";
    4Disk = "naa.600507681081001BA8000000000006FA";
    5Disk = "naa.600507681081001BA8000000000006FB"
}

$vm = Get-VM "VM1"

        $SCSIControllers = Get-ScsiController -VM $vm

        $SCSIController1 = $SCSIControllers | Where-Object {$_.ExtensionData.BusNumber -eq 1}

        $SCSIController2 = $SCSIControllers | Where-Object {$_.ExtensionData.BusNumber -eq 2}

        $SCSIController3 = $SCSIControllers | Where-Object {$_.ExtensionData.BusNumber -eq 3}

        Write-Host "Creating Disk and SCSI Controller 1"

New-HardDisk -VM $vm -DeviceName "/vmfs/devices/disks/$($UnassignedDisks.1disk)" -Datastore "MY_DATASTORE" -DiskType RawPhysical -Controller $SCSIController1

 

Not quite sure where I am going wrong here, all the parameters look to be correctly set, yet it always fails with the error listed above.

I have seen that this may be a bug with PowerCLI, is it still the case now?. Those posts were years old.
I also saw a reference to a lucd fix by using the add-hd function, but it still returns the same error regarding the incompatible device backing.

Here is my attempt to use add-hd

add-HD -VMName $vm -DSname "MY_DATASTORE" -Filename "/vmfs/devices/disks/$($UnassignedDisks.1disk)" -SCSIcntrl $SCSIController1
 

I would greatly appreciate some guidance here. Thanks!

 

22 Replies
LucD
Leadership
Leadership

How did you specify the BusSharingMode on the SCSI controller?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

CODETL19
Enthusiast
Enthusiast

I created the SCSI controllers in the GUI, with a setup of VMWAREParavirtual and Physical Bus sharing.

I also can replicate this error if I pipe new-hard disk into new-scsicontroller with the same settings

LucD
Leadership
Leadership

Can you add the RDM form the Web GUI?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

CODETL19
Enthusiast
Enthusiast

Yes I can, with absolutely no issues. Just by hitting 'Add New Device' -> 'RDM Disk'.
When I do it via the GUI, I set the RDM disk file to our desired datastore for the pointer files.

 

LucD
Leadership
Leadership

Strange.
Are there any more details about the error in the vpxd log?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

CODETL19
Enthusiast
Enthusiast

Yeah, here is what I found:

-- ERROR task-3926929 -- vm-372898 -- vim.VirtualMachine.reconfigure: vim.fault.InvalidDeviceBacking:
--> Result:
--> (vim.fault.InvalidDeviceBacking) {
--> faultCause = (vmodl.MethodFault) null,
--> faultMessage = <unset>,
--> property = "backing.deviceName",
--> deviceIndex = 0
--> msg = "Incompatible device backing specified for device '0'."
--> }
--> Args:
-->
--> Arg spec:
--> (vim.vm.ConfigSpec) {
--> changeVersion = <unset>,
--> name = <unset>,
--> version = <unset>,
--> createDate = "2023-01-12T01:45:56.272724Z",
--> uuid = <unset>,
--> instanceUuid = <unset>,
--> npivNodeWorldWideName = <unset>,
--> npivPortWorldWideName = <unset>,
--> npivWorldWideNameType = <unset>,
--> npivDesiredNodeWwns = <unset>,
--> npivDesiredPortWwns = <unset>,
--> npivTemporaryDisabled = <unset>,
--> npivOnNonRdmDisks = <unset>,
--> npivWorldWideNameOp = <unset>,
--> locationId = <unset>,
--> guestId = <unset>,
--> alternateGuestName = <unset>,
--> annotation = <unset>,
--> files = (vim.vm.FileInfo) {
--> vmPathName = "ds:///vmfs/volumes/5f16a8be-14e71f3e-3dcc-0025b531aa25/VMNAME/VMNAME.vmx",
--> snapshotDirectory = <unset>,
--> suspendDirectory = <unset>,
--> logDirectory = <unset>,
--> ftMetadataDirectory = <unset>
--> },
--> tools = (vim.vm.ToolsConfigInfo) null,
--> flags = (vim.vm.FlagInfo) null,
--> consolePreferences = (vim.vm.ConsolePreferences) null,
--> powerOpInfo = (vim.vm.DefaultPowerOpInfo) null,
--> numCPUs = <unset>,
--> vcpuConfig = <unset>,
--> numCoresPerSocket = <unset>,
--> memoryMB = <unset>,
--> memoryHotAddEnabled = <unset>,
--> cpuHotAddEnabled = <unset>,
--> cpuHotRemoveEnabled = <unset>,
--> virtualICH7MPresent = <unset>,
--> virtualSMCPresent = <unset>,
--> deviceChange = (vim.vm.device.VirtualDeviceSpec) [
--> (vim.vm.device.VirtualDeviceSpec) {
--> operation = "add",
--> fileOperation = "create",
--> device = (vim.vm.device.VirtualDisk) {
--> key = -100,
--> deviceInfo = (vim.Description) null,
--> backing = (vim.vm.device.VirtualDisk.RawDiskMappingVer1BackingInfo) {
--> fileName = "ds:///vmfs/volumes/6149dadc-dd45d8de-3e32-0025b531aa2b/VMNAME/VMNAME.vmdk",
--> datastore = <unset>,
--> backingObjectId = <unset>,
--> lunUuid = <unset>,
--> deviceName = "/vmfs/devices/disks/naa.600507681081001BA8000000000006F8",
--> compatibilityMode = "physicalMode",
--> diskMode = "persistent",
--> uuid = <unset>,
--> contentId = <unset>,
--> changeId = <unset>,
--> parent = (vim.vm.device.VirtualDisk.RawDiskMappingVer1BackingInfo) null,
--> deltaDiskFormat = <unset>,
--> deltaGrainSize = <unset>,
--> sharing = <unset>
--> },
--> connectable = (vim.vm.device.VirtualDevice.ConnectInfo) {
--> migrateConnect = <unset>,
--> startConnected = true,
--> allowGuestControl = false,
--> connected = true,
--> status = <unset>
--> },
--> slotInfo = (vim.vm.device.VirtualDevice.BusSlotInfo) null,
--> controllerKey = 1001,
--> unitNumber = 0,
--> numaNode = <unset>,
--> capacityInKB = 1,
--> capacityInBytes = <unset>,
--> shares = (vim.SharesInfo) null,
--> storageIOAllocation = (vim.StorageResourceManager.IOAllocationInfo) null,
--> diskObjectId = <unset>,
--> vFlashCacheConfigInfo = (vim.vm.device.VirtualDisk.VFlashCacheConfigInfo) null,
--> iofilter = <unset>,
--> vDiskId = (vim.vslm.ID) null,
--> virtualDiskFormat = <unset>,
--> nativeUnmanagedLinkedClone = <unset>,
--> independentFilters = <unset>
--> },
--> profile = (vim.vm.ProfileSpec) [
--> (vim.vm.EmptyProfileSpec) {
--> }
--> ],
--> backing = (vim.vm.device.VirtualDeviceSpec.BackingSpec) null,
--> filterSpec = <unset>
--> }
--> ],

 

Thanks for your help thus far

LucD
Leadership
Leadership

Shouldn't the DeviceName value just be the LUN, without the '/vmfs/...' part?

New-HardDisk -VM $vm -DeviceName $UnassignedDisks.1disk -Datastore "MY_DATASTORE" -DiskType RawPhysical -Controller $SCSIController1


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

CODETL19
Enthusiast
Enthusiast

I tried that, it just gives me this error:

Cannot bind parameter 'DeviceName' to the target. Exception setting "DeviceName": "Invalid value specified for the DeviceName parameter. Please specify a valid console device name."

LucD
Leadership
Leadership

That sounds rather unlikely since your hastable is incorrect.
The Key can not start with a number.
Like this it works for me

[hashtable]$unassignedDisks = @{
    Disk1 = "naa.600507681081001BA8000000000006FC"
    Disk2 = "naa.600507681081001BA8000000000006F8"
    Disk3 = "naa.600507681081001BA8000000000006F9"
    Disk4 = "naa.600507681081001BA8000000000006FA"
    Disk5 = "naa.600507681081001BA8000000000006FB"
}
$UnassignedDisks.Disk1


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

CODETL19
Enthusiast
Enthusiast

It definitely still does not work even if I make that change.

Even if I try and run the cmdlet like so:

New-HardDisk -VM $vm -DeviceName "naa.600507681081001BA8000000000006FC" -Datastore "MY_DATASTORE" -DiskType RawPhysical -Controller $SCSIController1

I get:

New-HardDisk: Cannot bind parameter 'DeviceName' to the target. Exception setting "DeviceName": "Invalid value specified for the DeviceName parameter. Please specify a valid console device name."

Maybe it is something specific to my environment?.

What version of VMWare.PowerCLI and Powershell are you running?

I am PS version 7.3.1 in VSCode

PowerCLI Version
----------------
   VMware.PowerCLI 13.0.0 build 20829139
---------------
Component Versions
---------------
   VMware Common PowerCLI Component 13.0 build 20797081
   VMware Cis Core PowerCLI Component PowerCLI Component 13.0 build 20797636
   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 13.0 build 20797821
   VMware VimAutomation Storage PowerCLI Component PowerCLI Component 13.0 build 20797966

LucD
Leadership
Leadership

I tested with PSv5.1 and PSv7.

Did you check if that LUN is actually available on the ESXi node where that VM is located?

Get-ScsiLun -VM ($vm.VMHost)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
CODETL19
Enthusiast
Enthusiast

Can confirm the LUN is showing / available on the ESXI host too

LucD
Leadership
Leadership

Did you also retry the Add-HD function with the correct LUN (without the full path /vmfs/...)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership

Also, does the vpxd log show

deviceName = "naa.600507681081001BA8000000000006F8"

when you use the correct devicename?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
CODETL19
Enthusiast
Enthusiast

No, the log shows the devicename as 'deviceName = "/vmfs/devices/disks/naa.600507681081001BA8000000000006F8"'

LucD
Leadership
Leadership

Seems I made a mistake, the DeviceName has to be the ConsoleDeviceName.
So it should include the '/vmfs/devices/disks/...' path.

Out of curiosity, do you get the same error when you call the API directly.
Something like this for example

$vmName = 'MyVM'
$diskNAA = 'naa.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

$vm = Get-VM -Name $vmName
$scsi = Get-ScsiController -VM $vm | Where-Object {$_.ExtensionData.BusNumber -eq 1}
$scsiKey = $scsi.Key
$unitNr = Get-HardDisk -VM $vm | %{$_.ExtensionData.UnitNumber} |
    Measure-Object -Maximum | select -ExpandProperty Maximum
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$dev = New-Object VMware.Vim.VirtualDeviceConfigSpec
$disk = New-Object VMware.Vim.VirtualDisk
$back = New-Object VMware.Vim.VirtualDiskRawDiskMappingVer1BackingInfo
$back.CompatibilityMode = 'physicalMode'
$back.FileName = ''
$back.DiskMode = [VMware.Vim.VirtualDiskMode]::independent_persistent
$back.Sharing = [VMware.Vim.VirtualDiskSharing]::sharingNone
$back.DeviceName = "/vmfs/devices/disks/$($diskNAA)"
$disk.Key = -100
$disk.ControllerKey = $scsiKey
$disk.UnitNumber = $unitNr + 1
$disk.Backing = $back
$dev.Operation = [VMware.Vim.VirtualDeviceConfigSpecOperation]::add
$dev.FileOperation = [VMware.Vim.VirtualDeviceConfigSpecFileOperation]::create
$dev.Device = $disk
$spec.DeviceChange += $dev

$vm.ExtensionData.ReconfigVM($spec)





Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
CODETL19
Enthusiast
Enthusiast

In response to your question regarding using the add-HD function, I did try it with just the naa.id but that changed nothing.

I tried the script you provided, and got 1 out of 5 disks to be successfully added to the VM.
This disk ID worked - naa.600507681081001ba8000000000006fc

The others give me the same error, even when calling the API using your script:

MethodInvocationException: Exception calling "ReconfigVM" with "1" argument(s): "Incompatible device backing specified for device '0'."

Strangely, I have re-tested using New-Harddisk, and its adding disks this way now, so I'm slightly confused as to what I was doing wrong.

Bare with me, I want to re-test the troubleshooting steps we've been through to see where the issue lies on my side. I will revert back once I have re-tested the disks and found which solution worked.

Your help has been much appreciated so far

 

CODETL19
Enthusiast
Enthusiast

After troubleshooting it again, turns out the disk UID (naa.) characters are case sensitive as we are running our ESXI hosts on linux.

As soon as I used a lower case letter for the uid, the new-harddisk cmdlet worked a treat.

Thanks for your help troubleshooting this issue lucd... rookie mistake by me...

LucD
Leadership
Leadership

Great to hear, wasn't aware these UDI were case-sensitive.

Does your "...as we are running our ESXI hosts on linux" mean that you are running your ESXi nodes virtualised and nested on a Linux platform?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos