I wrote a script that consolidates all of the VMs in a host cluster to maximize usable space. The script uses Move-VM to relocate machines to their new datastores.
My question revolves around how Move-VM handles VMs which have disk on multiple datastores.
My assumption is that it attempts to put all files associated with that VM together on the new datastore regardless or origin datastore.
In other words, a VM that was spread out on 3 different datastore would then be contained on the single datastore post migration.
Is this correct?
Yes, that is correct.
The Move-VM cmdlet only allows 1 datastore on the Datastore parameter.
You can of course use the Set-Harddisk cmdlet after the move, to relocate individual VMDK.
But that of course means that some VMDK will be relocated twice :smileycry:
If you want to move with a separate destination per VMDK, you have to go for the RelocateVM_Task method.
There is an example in Re: Using multiple datastores, can't migrate the vmx file to a datastore
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, that is correct.
The Move-VM cmdlet only allows 1 datastore on the Datastore parameter.
You can of course use the Set-Harddisk cmdlet after the move, to relocate individual VMDK.
But that of course means that some VMDK will be relocated twice :smileycry:
If you want to move with a separate destination per VMDK, you have to go for the RelocateVM_Task method.
There is an example in Re: Using multiple datastores, can't migrate the vmx file to a datastore
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference