14 Replies Latest reply on Jul 13, 2016 10:28 AM by Stromilov

    Move VM from one datastore to another

    _d1z Novice

      I have connected iSCSI target to ESXi server and now i want to move some VM`s from local datastore to iSCSI one. Which is the correct way of doing this?

        • 1. Re: Move VM from one datastore to another
          Karunakar Hot Shot

           

          HI,

           

           

          You can do this using the feature called StorageVmotion (SVmotion) , or you can also try to import the existing vmdk file of the vm to the new storage.

           

           

          use "vmkfstools -i <source> <destination>"

           

           

          you should specify the complete path of the vmdk file, as /vmfs/volumes/storage1/vmfolder/vmname.vmdk, same pattern for destination also.

           

           

          -Karunakar

           

           

          1 person found this helpful
          • 2. Re: Move VM from one datastore to another
            dkfbp Master
            vExpert

            Hi,

             

            Use the VI Client or Virtual Center. Shut down the virtual machine. Right click and click "migrate" then select to migrate it to the server it is already on and choose to relocate the storage.

             

            Best regards

            Frank Brix Pedersen

            • 3. Re: Move VM from one datastore to another
              weinstein5 Guru
              User Moderators

              Storage VMotion and MIgrate both require Virtual Center - if you do not have virtual center you will have to do it manually copy the vmdk file ove to the new storage and build a new vm and point to the existing virtual disks -

              • 4. Re: Move VM from one datastore to another
                _d1z Novice

                I am currently using this technique, but I don`t like that I have to create a new vm after importing, reconfigure network settings, etc..

                • 6. Re: Move VM from one datastore to another
                  brad6841 Novice

                  There is also a migration method via Powershell script for VMToolkit.  It will migrate the machine, but will cause momentary downtime.  It works by suspending the system, moving the files, and then unsuspending the system in it's new location.  I've never personally done it, but I read a post about it earlier this week.  Try doing a search for VMToolkit migration...

                  • 7. Re: Move VM from one datastore to another
                    Giznary Lurker

                    I know this is an old thread but, just to update for those new to ESXi, using ESXi 5 and the vSphere Client there are a handful of ways to move systems from one system to another that are all pretty straight-forward. The method I found (by which an experienced friend showed me because I didn't find one mention of this in the forums) is:

                    1. Power down the VM

                    2. Use the datastore browser to browse to where it is stored

                    3. Right-click> Move the entire folder to the desired datastore (presumably larger/faster/more free etc.)

                    4. Once moved right-click the VM> Remove from inventory

                    5. Use the datastore browser to go to the new storage location, navigate to the .vmx for the system. Right-click the .vmx> Add to inventory.

                    6. The machine will show back up in the list of VMs, but with an exclamation.

                    7. Click the VM, then the "Summary" tab. There will be a dialog that says something like "it looks like this system moved, did you move it or copy it or what?" with some radio buttons for Move/Copy/did not move. I chose "I moved it" each time and *walla* the system is moved from one datastore to another.

                     

                    I'm sure most folks figure this out pretty easy but, being a n00b, none of this was intuitive to me. Hopefully I help someone out.

                     

                    Enjoy!

                    • 8. Re: Move VM from one datastore to another
                      yonish Novice

                      try this

                       

                       

                      $vmne= "vm name (41330147-837a-455e-a607-453e5cbdeb23)" # vm to exclude for example very large or heavy  io machine
                      $lt_size="200" #  vm to exclude larger than size in GB
                      $cds=  "vCloud_XIV_Store5_L3"  #  storage vmotion current datastore
                      $tds=  "ds_vcloud1_pvdc1_lun1" # storage vmotion to datastore
                      $vms= Get-Vm -datastore $cds| where {$_.Name -ne $vmne } | Where { $_.UsedSpaceGB -lt $lt_size }
                      ($vms).count
                      $res=Get-ResourcePool -VM $vms
                      $res | select name,MemExpandableReservation,CpuExpandableReservation | ft -AutoSize
                      $res | Set-ResourcePool -CpuExpandableReservation:$true -MemExpandableReservation:$true
                      $vms | Move-VM -Datastore $tds -RunAsync
                      Start-Sleep 10
                      $res | Set-ResourcePool -CpuExpandableReservation:$false -MemExpandableReservation:$false

                      • 9. Re: Move VM from one datastore to another
                        rad01 Lurker

                        I realize this is an old thread, but could you not use the free VMware Vcenter Converter Standalone Client? It seems to do a great job of moving running machines, and can be configured to start the new instance and halt the old after conversion.

                         

                        Elapsed time estimate for my examples was about 1 hour 40 minutes. Actual time slightly less.

                        • 10. Re: Move VM from one datastore to another
                          ch1ta Hot Shot

                          Additionally, in similar cases I tend to use Quick Migration shipped by default in Veeam Free edition; allows me to migrate VMs between hosts, datastores or both with the minimal downtime.

                           

                          Cheers.

                          • 11. Re: Move VM from one datastore to another
                            hostasaurus Enthusiast

                            Just wanted to comment that Giznary's suggestion of using the datastore browser works great with one caveat; if the VM in question was originally thin provisioned, it will end up thick on the new datastore.  I'm not sure if that's also the case with the other methods proposed.

                            • 12. Re: Move VM from one datastore to another
                              ch1ta Hot Shot

                              Can't speak about other methods, but that's not the case with Quick Migration, as its wizard allows you either to preserve disk original type or to convert it to thick or thin. Cheers.

                              • 13. Re: Move VM from one datastore to another
                                ndmuser Enthusiast

                                You cannot use VMware Vcenter Converter Standalone Client to move VM folder to another datastore on the same esxi  if you do not have Vcenter. "Browse Datastore"  method described above works in this case.

                                • 14. Re: Move VM from one datastore to another
                                  Stromilov Lurker

                                  For VM without snapshots and RDM disks you can use Extrasphere solution even with free ESXi.