VMware Cloud Community
kcompton
Contributor
Contributor

Mass convert all VMDK's to Eager Zero?

Have thousands of VM's with multiple VMDK's each that are all on different tiers of SAN storage.  Looking for an easy way to migrate them all online without an outage to Thick Eager Zero, currently all Thick Lazy Zero.  Only successful way I've done this is via Advanced svMotion which works great but surely not easy when you're talking over 4,000 VMDK's.  Not sure if there's a way to force or set a default so all svMotions will convert to Eager Zero, or edit something on the vmdk descriptor so it will change automatically once it's moved with svMotion etc...  Basically looking for an easy automated way to make this happen and take "user error" out of the process Smiley Happy

Thanks!

0 Kudos
5 Replies
vmroyale
Immortal
Immortal

Note: Discussion successfully moved from VMware vCenter™ to Automation Tools

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
0 Kudos
mattboren
Expert
Expert

Hello,

Move-VM myVM0 -Datastore myDstore0 -DiskStorageFormat EagerZeroedThick -RunAsync

kcompton
Contributor
Contributor

The problem I have is I can't move an entire VM to a single datastore unfortunately.  Most our VM's have tiered storage (Gold, Silver, Bronze and Logs) so I would have to move each drive separately  Smiley Sad

Be nice if I could put a datastore in maintenance mode and have it convert everything to eagerthick while moving the VM's to another datastore in the cluster...

0 Kudos
mattboren
Expert
Expert

Hello, kcompton-

Old thread, I know, but, I wanted to mention the Evacuate Datastore code that Allen Crawford wrote about in his vNugglets.com post at http://www.vnugglets.com/2012/12/evacuating-vms-and-templates-from.html.  This will allow for the "moving each disk separately" -- it moves only virtual disks and VM config files that reside on the source datastore.

And, that code does not address changing the storageformat of the virtual disks during the move, but it seems that you could achieve that by adding another property to the VMware.Vim.VirtualMachineRelocateSpecDiskLocator object that is used in said code for the relocations.  Let us know if you go that avenue, and how it goes.

0 Kudos
Madmax01
Expert
Expert

i managed it with an input list. but you could do it also with an query for thick to push it to an variable.

important is also that enough Space is available on the destination Datastore.  (so change the FreeSpaceGB in my code if you use it)

connect-viserver xxxx

$csvpath = Read-Host ("Please input Path to csv")

$vms = import-csv  $csvpath

foreach ($vm in $vms){

$sourceDS = get-vm $vm.name |get-datastore |Select name

$cluster = get-vm $vm.name |get-cluster | Select name

$destDS = get-cluster $cluster.name |get-vmhost| get-datastore |Sort FreeSpaceGB |where-object {$_.name -ne $sourceDs.name -and $_.name -notmatch "local"  -and $_.FreeSpaceGB -gt 80} |Select -Last 1 | Select Name

write-host -fore Cyan `n`t "Starting Migration" $VM.name "from" $sourceDS.name  "to" $DestDS.name

move-vm $vm.name -Datastore $destDS.name -DiskStorageFormat EagerZeroedThick

write-host -fore Cyan `n`t "Finished migrating" $VM.name "Moving back...to" $sourceDS.name

move-vm $vm.name -Datastore $sourceDS.name

}

0 Kudos