VMware Cloud Community
grob115
Enthusiast
Enthusiast

Migrate VMs from ESXi4 host to new ESXi6 host

Hi I have some VMs running on an older ESXi4 host and want to migrate them to a newer ESXi6 host.  Given I am running the free ESXi versions I can only use cold migration.  However the ESXi6 documentation only describe using vCenter Server to manage a cold migration and there isn't any explanation on how to do this without using vCenter Server.  So is it as simple as simply doing the following steps?

  • Shut down VMs on old ESXi4 host.
  • scp all configurations and disk files from the ESXi4 host to the ESXi6 host via Putty.

But what do I do after I have copied over the files?  I can't find any import function on the vSphere client, and the wizard for creating a new VM also doesn't appear to allow us to specify to use existing files.  I checked vCenter Converter but it appears to be a bit over killed because it requires a server and a client to use it.  Veeam's Backup Free Edition also doesn't support ESXi6.

Tags (1)
19 Replies
RichardBush
Hot Shot
Hot Shot

Once they are copied over, browse the datastore, right click the Virtual Machine file and select add to inventory.

You will likely get a prompt asking if you moved or copied the VM when you power it on, select copied. Upgrade the vmtools and the virtual machine hardware version and you should be good.

Recommend keeping the original files just in case you run into issues.

Rich

grob115
Enthusiast
Enthusiast

Thanks.  Is this documented anywhere?  If yes can you point me to the reference?  Am also wondering whether I actually need to shut down the VMs first before doing the copy, or I can actually take a snapshot and copy the snapshot.  Caveat I think is if I start taking snapshot it'd create delta files which will get bigger and bigger until I run out of storage.

Reply
0 Kudos
RichardBush
Hot Shot
Hot Shot

‌Not sure I ve seen it documented anywhere, it's just a method used by the numerous.

Personally I'd shut them down, you could use VMware converter to do this, which would allow you to keep the machine online and then do a kind of catch up on any change, but that will only work should you have a vcenter server.

Not sure on your storage, but another way would be to present the storage to the esxi 6 host, shut them down on the 4 host and add to inventory on the 6, you could then use storage vmotion place them on the correct storage. Assuming you have shared storage.

rich

Reply
0 Kudos
grob115
Enthusiast
Enthusiast

Hi there I actually have done some further research and found the following:

VMware KB: Moving or copying a virtual machine within a VMware environment

This KB appears to describe what you are suggesting but only provides high level steps.  It suggests either one of the following can be done.

Copying or moving the virtual machine and virtual disks

- This is similar to what you described in the sense that we need to register, upgrade virtual hardware, etc.

  1. Select the virtual machine.
  2. Commit all snapshots on the virtual machine. For more information, see Committing snapshots from within the Service Console (1006847).
  3. Identify the working directory of the virtual machine.
  4. Identify the location of all virtual disks.
  5. Power off the virtual machine.
  6. Create a folder for the copy of the virtual machine.
  7. Copy the virtual machine configuration file ( .vmx) to the new folder.
  8. Copy the virtual disks to the new folder. For more information, see Moving or Copying Virtual Disks in a VMware Environment (900).
  9. Register the new virtual machine.
  10. Add the virtual disk copies to the virtual machine copy.
  11. Upgrade the virtual hardware if necessary.
  12. Power on the virtual machine.
  13. Test the new virtual machine.
  14. Optionally, delete the original virtual machine files.

Creating a new virtual machine and copying or moving the virtual disks

- This appears to be an easier version but achieves the same thing.  However step 6 doesn't make sense to me.  Is it suggesting to move the virtual disks for the source VM to a different location?  Why would I have to do this if I'm keeping the source VM powered off?  And when you said "Once they are copied over, browse the datastore, right click the Virtual Machine file and select add to inventory." this is what is meant by step 9?

  1. Select the virtual machine.
  2. Make note of the networking, memory, and CPU configuration of the virtual machine.
  3. Commit all snapshots on the virtual machine. For more information, see Committing snapshots from within the Service Console (1006847).
  4. Identify the location of all virtual disks.
  5. Power off the virtual machine.
  6. Remove virtual disks.
    Warning: Do not delete the virtual disk.
  7. Create a new virtual machine and recreate the configuration identified in step 2.
  8. Copy the virtual disks to the folder of the new virtual machine.For more information, see Moving or Copying Virtual Disks in a VMware Environment (900).
  9. Add the virtual disk copies to the new virtual machine.
  10. Power on the new virtual machine.
  11. Test the new virtual machine.
  12. Optionally, delete the original virtual machine files.

Another question is, the same KB suggests there are two converter tools.  One is named "VMware Converter" and another one is named "VMware vCenter Converter".  I recall having seen a blog online somewhere describing "VMware Converter" and it doesn't appear to require vCenter Server whereas "VMware vCenter Converter" does require vCenter Server.  The problem is I can only find download links available for "VMware vCenter Converter" but not "VMware Converter".  Any idea if "VMware Converter" is still available?  The KB was only written less than a year ago!

Digging further it appears there are 2 VMware vCenter Converter:

- VMware vCenter Converter: P2V Virtual Machine Converter | United States

- Download VMware vCenter Converter Standalone for P2V Conversion

It appears the VMware vCenter Converter Standalone doesn't require a vCenter Server and can run entirely on my desktop?  Am reading the manual now but there are quite a number of pages.

Reply
0 Kudos
grob115
Enthusiast
Enthusiast

Okay just checked out both vCenter Converter and vCenter Converter Standalone and here is a summary.  Because all my VMs are running Centos 5.5, so it appears vCenter Converter is not a tool I can use to do the migration from the ESXi4 host to the ESXi6 host!

vCenter Converter

- Latest version is 5.0.1 per VMware vCenter Converter: P2V Virtual Machine Converter | United States

- Supports neither ESXi6 and Centos OS per VMware vCenter Converter Standalone Release Notes

- Requires vCenter Server for ESXi related destination.

vCenter Converter Standalone

- Latest version is 6.0 per VMware vCenter Converter Standalone Documentation

- Version 6.0 supports ESXi6 but CentOS 6.x and 7.x only per VMware vCenter Converter Standalone Release Notes.  It does say RHEL 5.x is supported but the fact that CentOS is only listed for 6.x and 7.x makes me nervous.

- Previous version (ie 5.5.2) supports neither CentOS and ESXi6 per VMware vCenter Converter Standalone Release Notes

Reply
0 Kudos
npadmani
Virtuoso
Virtuoso

  1. Remove virtual disks.
    Warning: Do not delete the virtual disk.

this step is trying to tell you that when you remove disk from VM, you will see two options. like following screenshot

Screen Shot 2015-07-10 at 11.59.24 am.png

out of two options, select first one, please don't go with second option.

Creating a new virtual machine and copying or moving the virtual disks

- This appears to be an easier version but achieves the same thing.  However step 6 doesn't make sense to me.  Is it suggesting to move the virtual disks for the source VM to a different location?  Why would I have to do this if I'm keeping the source VM powered off?  And when you said "Once they are copied over, browse the datastore, right click the Virtual Machine file and select add to inventory." this is what is meant by step 9?

in this procedure, all that KB is asking you to do is, create a brand new VM (with latest Hardware version if you wish) in your new ESXi host without any vDisk. Rest of the virtual hardware settings like no of vCPUs, amount of RAM and vNICs let those to be same as your old VM. then detach the vDisk from old VM, copy it and paste it into folder of new VM. then attach it (add existing virtual disk) to your new VM (step-9).

but then I think in your case, if you go with following process which you listed from KB (and RichardBush as also explained same), that should work well.

Copying or moving the virtual machine and virtual disks

as your hardware version of VM from old esxi is fully compatible with new ESXi and you can then upgrade it also if you wish.

Narendra Padmani VCIX6-DCV | VCIX7-CMA | VCI | TOGAF 9 Certified
grob115
Enthusiast
Enthusiast

Narendra, thanks!  That really clears up the confusion for how we can remove disks without deleting them.  I can now see the difference between the two options are as follow.

Copying or moving the virtual machine and virtual disks

- Relies on .vmx file which describes VMware hardware version.

- Need to upgrade VMware hardware version if wanted.

Creating a new virtual machine and copying or moving the virtual disks

- Does not require to copy .vmx file so need to recreate the network / memory / CPU configurations.

- No need to upgrade VMware hadware version because the VM is re-created.

Question is given the source VM is already powered down, why would I want to remove the virtual disks from it?  Can I not just copy it over to the new destination VM's folder?

Reply
0 Kudos
npadmani
Virtuoso
Virtuoso

Question is given the source VM is already powered down, why would I want to remove the virtual disks from it?  Can I not just copy it over to the new destination VM's folder?

well, It should work as it is, since your VM is powered off already.

listed step to detach vDisk is to prevent following situation,

let's say you have this VMDK which is quite big in size and you are going through copy/paste process. What if one of the other administrator try to power on VM, that will trouble since system will try to lock that VMDK during this power on operation.

Narendra Padmani VCIX6-DCV | VCIX7-CMA | VCI | TOGAF 9 Certified
grob115
Enthusiast
Enthusiast

Hi that makes sense.  But I guess if I'm the only one doing then it's fine without removing the disk from the old VM.

Just tried following the "Copying or moving the virtual machine and virtual disks" method, and in brief here are the steps:

1) Create new directory for new VM.

2) Shut down old VM.

3) Copy all files from old VM's folder to new VM's folder.

4) Browse on vSphere client datastore to the new VM's folder, right click on the .vmx file just copied, and select "Add to Inventory".  The thing however is I didn't have to do Step 10 which is "Add the virtual disk copies to the virtual machine copy." because I already have copied both .vmdk file over in Step 8.  Any idea how Step 10 is different from Step 8?

AddVMToInventory.png

5) When powering up the new VM I see the following, asking if the VM was copied or moved.  Not really sure what the difference it'd make.  Can you elaborate on what happens when either options are selected?

QuestionOnCopyOrMove.png

Reply
0 Kudos
npadmani
Virtuoso
Virtuoso

3) Copy all files from old VM's folder to new VM's folder.

4) Browse on vSphere client datastore to the new VM's folder, right click on the .vmx file just copied, and select "Add to Inventory".  The thing however is I didn't have to do Step 10 which is "Add the virtual disk copies to the virtual machine copy." because I already have copied both .vmdk file over in Step 8.  Any idea how Step 10 is different from Step 8?

in this case, you have copied all the files from old VM folder to new, so there's no need to attach virtual disks, they are already attached.

I copied it or I moved it? answer to that is there in following KB

VMware KB: Changing or keeping a UUID for a moved virtual machine

Narendra Padmani VCIX6-DCV | VCIX7-CMA | VCI | TOGAF 9 Certified
RichardBush
Hot Shot
Hot Shot

‌i am under the impression that it updates the paths to all relevant files on move, I assume copied is something to do with the vm Id, but I can't say that with complete confidence.

edit, was beaten to this, above post is the kb that explains it all.

rich

Reply
0 Kudos
npadmani
Virtuoso
Virtuoso

step - 8 and step 10

As Richard is mentioning Path, now that is something worth checking. when you successfully power on VM, is it booting OK?

if you go to Edit Settings of the VM -> VM Options Tab

what's the path of the VM virtual disk, if that's still posting to old location, then you got to do re-attach virtual disks.

Narendra Padmani VCIX6-DCV | VCIX7-CMA | VCI | TOGAF 9 Certified
Reply
0 Kudos
grob115
Enthusiast
Enthusiast

Hi, thanks for the replies.

I copied it or I moved it? answer to that is there in following KB

VMware KB: Changing or keeping a UUID for a moved virtual machine

This is helpful.  My goal is to move the VMs currently running on the ESXi4.x host to the new ESXi6.0 host.  So I'll be powering off them on the old host, copying them to the new host, and starting them there to see if it works.  If it works, great and I can leave the original VMs on the ESXi4.x host powered off.  If it doesn't work, then I'll switch off the new VMs on the ESXi6 host and start the old VMs on the ESXi4 host again.

Given that, I guess it doesn't matter whether I select "I copied it" or "I moved it".  I guess it's cleaner to select "I copied it" to generate a new UUID but it's safer to select "I moved it" to keep the UUID same just in case anything on the OS reference or refers to the UUID.

step - 8 and step 10

As Richard is mentioning Path, now that is something worth checking. when you successfully power on VM, is it booting OK?

if you go to Edit Settings of the VM -> VM Options Tab

what's the path of the VM virtual disk, if that's still posting to old location, then you got to do re-attach virtual disks.

Kind of.  The VM I used for the test definitely have started okay but aren't working properly due to some other issues which I think is not related to what we're doing here.  I don't have the full path available now as I just deleted the VM from disk.  I will have a check later on this as it's a good sanity check.  As for re-attach virtual disk as described on step 10, I'm not sure how to do this.  Can you paste a screen shot?

Reply
0 Kudos
npadmani
Virtuoso
Virtuoso

they are just asking you to add new hardware device in your VM, select Hard disk from the list of hardware devices and go on...

like following

1) Edit settings of the VM, click on Add Button

Screen Shot 2015-07-10 at 4.49.18 pm.png

Select Hard Disk as per following screen

Screen Shot 2015-07-10 at 4.49.54 pm.png

go with 'User existing vDisk'

Screen Shot 2015-07-10 at 4.50.10 pm.png

Browse vDisk from VM folder, and let that be attached.

Screen Shot 2015-07-10 at 4.50.20 pm.png

see if this helps.

Narendra Padmani VCIX6-DCV | VCIX7-CMA | VCI | TOGAF 9 Certified
Reply
0 Kudos
grob115
Enthusiast
Enthusiast

Okay I see.  The test I did was on the same ESXi6 host so I guess even if the new target VM folder to which I copied the source VM files to some how when started is still pointing to the source folder's virtual disk, the new VM can still start up.  Unfortunately I ran out of time so can't do further testing but when I do the actual migration from one host to another I guess we can tell, and will know if step 10 of re-adding the virtual disk file is necessary.

Reply
0 Kudos
npadmani
Virtuoso
Virtuoso

I have done a test already now.

Results:

if your VM's vmx file and vmdk files are in same folder, just copy and paste would be a perfectly OK, because in that case VM's vmx file is holding references to VMDK files.

So no need for STEP - 10 to be performed.

But

if your VM's vmx file and VMDK files are located at different locations, like your VM is stored in Datastore1 and associated VMDKs are stored in Datastore2, in that case when you copy that VM's files to a different datastore, you will have to perform Step-10 activities, otherwise your VM will keep pointing to old location.

I guess in your case, your VM vmx + vmdks are stored in same folder so when you did your test, it happened from VMDKs copied, not from the old location.

Narendra Padmani VCIX6-DCV | VCIX7-CMA | VCI | TOGAF 9 Certified
grob115
Enthusiast
Enthusiast

Thanks!

Reply
0 Kudos
grob115
Enthusiast
Enthusiast

Hi, btw, according to VMware KB: Moving or copying virtual disks in a VMware environment, I see it says the following.

Copying virtual disk files using the vSphere Command Line Interface for ESX and ESXi

Unlike ESX, ESXi does not have a service console. To copy files, use the vifs utility that comes with the vSphere Command Line Interface. The vifs command performs common operations such as copy, remove, get (download), and put (upload) files. The command is supported against ESXi/ESX hosts but not against vCenter Server systems. Use the vifs command to perform the file operation on the virtual machine files. For information on syntax and usage examples, see the vSphere Command-Line Interface Installation and Reference Guide.

Question is how is this vifs command different than me doing something like scp if I'm transferring the VM's associated files such as vmdk, vmx, vmsd, vmxf, nvram, etc to a new host?

Reply
0 Kudos
Craig_Baltzer
Expert
Expert

You can use OVFTool (free download from VMware) to get this done in one step. William Lam (@lamw) who works for VMware has a good overview write-up on this

How to Copy VMs Directly Between ESXi Hosts Without Shared Storage | virtuallyGhetto

Far easier than using SCP, VMware Converter, adding files to inventory with the VI Client, etc., etc., etc. You can handle all the assign to datastore, vSwitch,etc. as part of the move command line. All that's left after the move is upgrade VMware tools (tick the box to "upgrade on reboot") then upgrade the virtual hardware and you're done...

Reply
0 Kudos