<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Datastore Evacuation with PowerCLI in VMware PowerCLI Documents</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/ta-p/2787334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We were recently asked by our storage team to migrate all VMs off of&amp;nbsp; one array we are using and onto another.&amp;nbsp; Not being a huge fan of&amp;nbsp; planning and carrying out a move like this one virtual disk at a time, I&amp;nbsp; decided to take a stab at a datastore evacuation script.&amp;nbsp; There was&amp;nbsp; already some know-how out there, so I started poking around and found&amp;nbsp; some useful posts &amp;amp; threads:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://get-admin.com/blog/how-to/vmware/powercli-evacuate-a-datastore/" target="_blank"&gt;http://get-admin.com/blog/how-to/vmware/powercli-evacuate-a-datastore/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.vmware.com/thread/299279" target="_blank"&gt;http://communities.vmware.com/thread/299279/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My main issue with existing scripts that I found was that they&amp;nbsp; presumed the entire VM was on a single datastore – not the case in our&amp;nbsp; environment.&amp;nbsp; In fact, virtual disks associated with a single VM are&amp;nbsp; often on different tiers of storage for our customers.&amp;nbsp; I set out to do&amp;nbsp; write this code with that in mind, and the result is a script that&amp;nbsp; simply moves the vmdk’s that exist on one datastore to the destination,&amp;nbsp; without touching anything I didn’t ask to be moved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, giving credit where it’s due, I simply took &lt;A href="http://www.lucd.info/" target="_blank" title="LucD notes"&gt;Luc Dekens’ (LucD)&lt;/A&gt; code snippet from the VMware Communities thread on migrating a VM’s&amp;nbsp; config files and plopped it into a function (migrateVMConfig) in my&amp;nbsp; code.&amp;nbsp; Thanks Luc!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current iteration of the migrateDatastore function checks for two criteria before proceeding with the move:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The destination datastore is equal in Capacity or larger than the source&lt;/LI&gt;&lt;LI&gt;The Free Space on the destination is greater than or equal to the Used Space on the source&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first check can probably be removed at some point, but the second&amp;nbsp; is kind of a no-brainer – you can’t move actual used space to something&amp;nbsp; smaller than it’s current datastore unless you are also going from&amp;nbsp; thick to thin provisioned (which this script does not currently do).&lt;/P&gt;&lt;P&gt;I tested this script extensively in my dev environment before&amp;nbsp; proceeding with any production moves, but please let me know if any bugs&amp;nbsp; or problems crop up.&amp;nbsp; Along those lines, if you want to use this script&amp;nbsp; please do your own testing before using it in production, and always&amp;nbsp; start with one datastore at a time before progressing to large-scale&amp;nbsp; evacuations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usage (from the PS CLI):&lt;/P&gt;&lt;PRE&gt;.\MigrateDatastore.ps1 -VIServer "myvcenter.mydomain.com" -sourceDatastore "DS01" -destinationDatastore "DS02"&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(originally posted on my blog: &lt;A href="http://virtualcurtis.wordpress.com/2011/05/06/get-off-my-array-scripting-datastore-migrations-with-powercli/"&gt;&lt;SPAN&gt;Get off my array! (Scripting datastore migrations with PowerCLI)&lt;/SPAN&gt;&lt;/A&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 May 2011 23:58:18 GMT</pubDate>
    <dc:creator>lockenkeyster</dc:creator>
    <dc:date>2011-05-11T23:58:18Z</dc:date>
    <item>
      <title>Datastore Evacuation with PowerCLI</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/ta-p/2787334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We were recently asked by our storage team to migrate all VMs off of&amp;nbsp; one array we are using and onto another.&amp;nbsp; Not being a huge fan of&amp;nbsp; planning and carrying out a move like this one virtual disk at a time, I&amp;nbsp; decided to take a stab at a datastore evacuation script.&amp;nbsp; There was&amp;nbsp; already some know-how out there, so I started poking around and found&amp;nbsp; some useful posts &amp;amp; threads:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://get-admin.com/blog/how-to/vmware/powercli-evacuate-a-datastore/" target="_blank"&gt;http://get-admin.com/blog/how-to/vmware/powercli-evacuate-a-datastore/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.vmware.com/thread/299279" target="_blank"&gt;http://communities.vmware.com/thread/299279/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My main issue with existing scripts that I found was that they&amp;nbsp; presumed the entire VM was on a single datastore – not the case in our&amp;nbsp; environment.&amp;nbsp; In fact, virtual disks associated with a single VM are&amp;nbsp; often on different tiers of storage for our customers.&amp;nbsp; I set out to do&amp;nbsp; write this code with that in mind, and the result is a script that&amp;nbsp; simply moves the vmdk’s that exist on one datastore to the destination,&amp;nbsp; without touching anything I didn’t ask to be moved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, giving credit where it’s due, I simply took &lt;A href="http://www.lucd.info/" target="_blank" title="LucD notes"&gt;Luc Dekens’ (LucD)&lt;/A&gt; code snippet from the VMware Communities thread on migrating a VM’s&amp;nbsp; config files and plopped it into a function (migrateVMConfig) in my&amp;nbsp; code.&amp;nbsp; Thanks Luc!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current iteration of the migrateDatastore function checks for two criteria before proceeding with the move:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The destination datastore is equal in Capacity or larger than the source&lt;/LI&gt;&lt;LI&gt;The Free Space on the destination is greater than or equal to the Used Space on the source&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first check can probably be removed at some point, but the second&amp;nbsp; is kind of a no-brainer – you can’t move actual used space to something&amp;nbsp; smaller than it’s current datastore unless you are also going from&amp;nbsp; thick to thin provisioned (which this script does not currently do).&lt;/P&gt;&lt;P&gt;I tested this script extensively in my dev environment before&amp;nbsp; proceeding with any production moves, but please let me know if any bugs&amp;nbsp; or problems crop up.&amp;nbsp; Along those lines, if you want to use this script&amp;nbsp; please do your own testing before using it in production, and always&amp;nbsp; start with one datastore at a time before progressing to large-scale&amp;nbsp; evacuations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usage (from the PS CLI):&lt;/P&gt;&lt;PRE&gt;.\MigrateDatastore.ps1 -VIServer "myvcenter.mydomain.com" -sourceDatastore "DS01" -destinationDatastore "DS02"&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(originally posted on my blog: &lt;A href="http://virtualcurtis.wordpress.com/2011/05/06/get-off-my-array-scripting-datastore-migrations-with-powercli/"&gt;&lt;SPAN&gt;Get off my array! (Scripting datastore migrations with PowerCLI)&lt;/SPAN&gt;&lt;/A&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2011 23:58:18 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/ta-p/2787334</guid>
      <dc:creator>lockenkeyster</dc:creator>
      <dc:date>2011-05-11T23:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Evacuation with PowerCLI</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/tac-p/2787335#M230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great script.&lt;/P&gt;&lt;P&gt;Thanks for sharing this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 06:49:34 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/tac-p/2787335#M230</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2011-05-12T06:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Evacuation with PowerCLI</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/tac-p/2787336#M231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Is it possible to update this script to allow for the modification of the virtual disk format as part of the move?&amp;nbsp; I'm wanting to migrate VMs from one datastore to another and change the format from thin to thick eager zeroed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 21:53:16 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/tac-p/2787336#M231</guid>
      <dc:creator>Rmitchell32</dc:creator>
      <dc:date>2012-08-01T21:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Datastore Evacuation with PowerCLI</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/tac-p/2787337#M232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe that adding the -Inflate parameter to each of the Set-HardDisk commands (lines 83 &amp;amp; 87) would accomplish this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set-Harddisk -Harddisk $disk -Datastore $destinationDS -Inflate -Confirm:$False&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 21:36:59 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Datastore-Evacuation-with-PowerCLI/tac-p/2787337#M232</guid>
      <dc:creator>lockenkeyster</dc:creator>
      <dc:date>2012-08-02T21:36:59Z</dc:date>
    </item>
  </channel>
</rss>

