VMware Cloud Community
_d1z
Enthusiast
Enthusiast

Move VM from one datastore to another

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?

14 Replies
Karunakar
Hot Shot
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

dkfbp
Expert
Expert

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

Best regards Frank Brix Pedersen blog: http://www.vfrank.org
0 Kudos
weinstein5
Immortal
Immortal

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 -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
_d1z
Enthusiast
Enthusiast

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..

0 Kudos
Formatter
Enthusiast
Enthusiast

have a look at the last post by me in

0 Kudos
brad6841
Contributor
Contributor

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...

0 Kudos
Giznary
Contributor
Contributor

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!

yonish
Contributor
Contributor

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

0 Kudos
rad01
Contributor
Contributor

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.

0 Kudos
ch1ta
Hot Shot
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.

0 Kudos
hostasaurus
Enthusiast
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.

0 Kudos
ch1ta
Hot Shot
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.

0 Kudos
ndmuser
Enthusiast
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.

0 Kudos
Stromilov
Contributor
Contributor

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

0 Kudos