VMware Cloud Community
brocktravis
Contributor
Contributor
Jump to solution

Move-VM Functionality Question

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?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos