VMware Cloud Community
Mr_G_Grant
Enthusiast
Enthusiast
Jump to solution

Storage V-motion

Hi Guy's,

I have a load of storage v-motions to complete over the next weekend. Rather than use scheduled tasks and guessimate a schedule does anybody know if its possible to schedule maybe 3 storage v-motions at once and have the next system in line migrate but only after the previous storage v-motion has completed.

I hope this all makes sense.

Regards

Mr G

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

No, my mistake. Use this instead

Get-VM -Datastore someDatastore | Get-HardDisk | `
where {$_.Name -eq "Hard disk 1"} | `
Set-HardDisk -Datastore anotherDatastore


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

View solution in original post

Reply
0 Kudos
8 Replies
bckirsch
Enthusiast
Enthusiast
Jump to solution

Orchastrator is the way to go but I bet you could do it with PS as well because PS will execute them as listed in the script and should not start the next Storage vMotion until the previous one finishes.

Reply
0 Kudos
mattboren
Expert
Expert
Jump to solution

Hello,

You can do them in series (one at a time) with something like:

Get-VM -Datastore someDatastore | Move-VM -Datastore anotherDatastore -Confirm:$false

Or, could also initiate the sVMotions asynchronously using the -RunAsync parameter and let vCenter handle the queuing of the tasks, like:

Get-VM -Datastore someDatastore | Move-VM -Datastore anotherDatastore -Confirm:$false -RunAsync

How do those do?

Reply
0 Kudos
Mr_G_Grant
Enthusiast
Enthusiast
Jump to solution

Is there anyway to select a specific disk for migration only?

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the Set-HardDisk cmdlet to move a specific disk to another datastore. E.g.:

Set-HardDisk -HardDisk $harddisk -Datastore $datastore

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
LucD
Leadership
Leadership
Jump to solution

Yes you can.

Suppose you want to only svMotion "Hard disk 1" for all the VMs to another datastore, then you can do

Get-VM -Datastore someDatastore | Get-HardDisk -Name "Hard disk 1" | `
Set-HardDisk -Datastore anotherDatastore

Unfortunately, the Set-Harddisk cmdlet has no RunAsync parameter. So each svMotion will be executed in sequence.


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

Reply
0 Kudos
RParker
Immortal
Immortal
Jump to solution

Mr G Grant wrote:

Hi Guy's,

I have a load of storage v-motions to complete over the next weekend. Rather than use scheduled tasks and guessimate a schedule does anybody know if its possible to schedule maybe 3 storage v-motions at once and have the next system in line migrate but only after the previous storage v-motion has completed.

I hope this all makes sense.

Regards

Mr G

Vcenter will only let you migrate 2 per server, and 2 per storage at a time. So if you kick them ALL off, only 2 will be done, the next will queue.. I am pretty sure vCenter will wait forever until the vMotion completes.  I know when I do like 4 at once they wait until the others are done.. and sometimes it takes a few hours...

Reply
0 Kudos
Mr_G_Grant
Enthusiast
Enthusiast
Jump to solution

When i use the Get-HardDisk cmdlet there does not appear to be a -Name paramater. I use Powercli to write scripts so am i missing something here?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, my mistake. Use this instead

Get-VM -Datastore someDatastore | Get-HardDisk | `
where {$_.Name -eq "Hard disk 1"} | `
Set-HardDisk -Datastore anotherDatastore


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

Reply
0 Kudos