VMware Cloud Community
kyfbof
Contributor
Contributor

Storage vmotion a VM with multiple datastores

Hi,

I have several VMs that have .vmdk for themselves and some being shared with other VMs.

My understanding is that "Move-VM testVM -Datastore newDS" would target all of the disks that testVM has access to and move them to newDS. If the testVM's .vmdk files reside on multiple datastores (DS1, DS3 and DS7 say), is there a way that I can specify only storage from DS7 are targeted to move to newDS.

Better yet, is there a command to migrate the content of one datastore to a new one, and reconfigure all of the objects to use the new one.

Thx

Tags (1)
5 Replies
LucD
Leadership
Leadership

I'm afraid that is not possible with a cmdlet.

But you can use the Relocate-VM method to do this.

See for example 11. Re: Using multiple datastores, can't migrate the vmx file to a datastore


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

LucD
Leadership
Leadership

An alternative method, with only cmdlets, could be the following:

  • Stop the VM
  • Remove (not delete) all harddisk, sitting on the datastore, from the VM
  • Move these harddisks with the Move-HardDisk cmdlet to the desired datastore
  • Connect the harddisks back to the VM
  • Start the VM


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

Reply
0 Kudos
DjinjiRinji
Enthusiast
Enthusiast

I used this one in the past to migrate a complete array give it a try

Get off my array! (Scripting datastore migrations with PowerCLI) | Notes from a Sysadmin

Kindly mark as solved if your questions are answered.
>>>>>
Guillermo R
LinkedIn: https://www.linkedin.com/in/gramallo
Web: http://bakingclouds.com/
Reply
0 Kudos
kyfbof
Contributor
Contributor

Hi Luc,

  The first step - "Stop the VM" - makes this approach not feasible. I looked at your other approaches: "Relocate-VM" and "Move independent disks", and I think they are more applicable to deal with with my issue.

  I will utilize your code as the foundation, wrap it with add'l tasks to fit our project's objectives, test it out and post the result later. The Relocate-VM is little bit abstracted for me ... I dont know when the "copy or storage vmotion" happens and how I would be able to control that activity. But that's what testing for!

  In short, appreciate the lead ... just that it's technically not the answer yet.

Reply
0 Kudos
LucD
Leadership
Leadership

Let me know if you get stuck.


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

Reply
0 Kudos