Invalid Operation for Device ‘0’ on VMware ESXi / Virtualization / VMware / Invalid Operation for Device ‘0’ on VMware ESXi

When you try to increase the virtual disk size of a VM on VMware ESXi/vCenter, you might receive an Invalid operation for device ‘0’ error. In this article, we will look at the cause of this error and how to fix it.

Operation failed!
Task name: Reconfigure virtual machine
Target: TestVM
Status: Invalid operation for device '0'.

VMWare VM: cant expand disk - Invalid operation for device '0

The presence of snapshots in the virtual machine is the most common reason for this error. Open the Virtual Machine Action menu, and select Snapshots -> Delete All Snapshots.

If the Virtual Machine summary box displays the message ‘Virtual Machine disks consolidation is needed’, you must also click the Consolidate button to properly merge the snapshot files.

VM: Delete snapshots

If snapshots are not causing the ‘Invalid operation for device 0‘ error, you should try increasing the VM disk size using PowerShell.

Install the VMware PowerCLI module on your Windows machine:

Install-Module -Name VMware.PowerCLI

Connect to your vCenter or ESXi host:

Connect-VIServer -Server vmwarehost -Protocol https -User root -Password passW0ef

List the VM disks:

Get-HardDisk -vm TestVM | Select Name,CapacityGB,Filename

Name CapacityGB Filename
---- ---------- --------
Hard disk 1 10 [A]
Hard disk 2 50 [A]

Run the following command to expand the virtual machine disk size:

Get-HardDisk -vm TestVM -name "Hard disk 1" | Set-HardDisk -capacityGB 15
Leave a Reply

Your email address will not be published. Required fields are marked *