VMware Cloud Community
kaychan
Contributor
Contributor

Migrate VM between ESX hosts under different data centers

Hi,

I need to migrate a VM over the WAN from one of my ESX host to another ESX host at another data center. I am thinking of using SCP to copy the vmdk files over to the other ESX host and then re-create the VM from the VMDK files. After SCPing the files over, do I need to run vmfstool -i to import the vmdk before I can recreate the VM?? Both target and source ESX servers are running on the same platform (ESX 3.01).

Or is there a better way which I can use to do the migration??

Thanks.

Reply
0 Kudos
10 Replies
madcult
Enthusiast
Enthusiast

Hi, I would do it like this:

1) shutdown VM

2) unregister VM in VirtualCenter

3) gzip your VMDK-files (depends on your WAN speed, we can compress our VMDK files from about 20 GB to 3 GB!!! )

4) SCP ALL FILES to another host

5) gunzip your VMDK-files

6) register it in VirtualCenter

7) start it

You do not need to "vmkfstools -i" (=clone) your VMDK files.

Message was edited by: madcult

Reply
0 Kudos
kjb007
Immortal
Immortal

gzip does have a limit on the generated filesize. If I don't reach the limit, that's a good way to go. What I would suggest before the gzip though, is to create a tar ball of them first, then try to gzip. Personally, I would not attempt to copy a fileset that large as individual files. One file, in its entirety is a lot easier to make sure is whole, then several smaller files. Use a tarball or zip image.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
kaychan
Contributor
Contributor

What is the limit of gzip and how do I create a tarball of the fileset??

Sorry I am not familar with unix, I am a windows person.

Thanks for your help.

Reply
0 Kudos
kjb007
Immortal
Immortal

gzip has a limit of a 4GB filesize, after compression.

To create a "tarball", log in to the service console. Make sure you have enough space in the datastore, or wherever you want to put the tarball. tar does not compress, per se, so you'll need to have the same size as your vm folder, in order to complete successfully.

Cd /vmfs/volumes/<datastore>

tar -cf /path/to/where/you/want/to/put/tar/file/<vm_name>.tar <vm_filder_name>

This will create <vn_name>.tar in the location you specified. You can copy that in its entirety, or when the tar is done, cd into the location you specified, and type gzip <vm_name>.tar. If the gzip is successful, you will have <vm_name>.tar.gz

Copy that file to the new server, and then cd into where you want to put the vm.

If gzip was successful and you copied the gzip'd file, type gunzip <vm_name>.tar.gz.

Otherwise, or after that completes, type tar -xf <vm_name>.tar

-KjB

kjb007: Made directions a little more clear

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
kaychan
Contributor
Contributor

Thank you so much for the info.

I will try that.

Reply
0 Kudos
kaychan
Contributor
Contributor

When I try to do the tar, I found there are 2 vmdk files. One is the flat-vmdk 10 GB in size (size of the disk assigned to VM) and the other one is just a vmdk about 350 MB in size. I think the flat one is the one that I should compressed and copy to the new ESX server. Then I would recreate it using the copied VMDK.

What is the small vmdk file for?? Do I need it??

Thanks.

Reply
0 Kudos
kjb007
Immortal
Immortal

You need all of the files. The flat file is the hard disk, but the one without "flat" in the name is a descriptor file that describes your flat file. Without that, your disk won't work.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
bwiechman
Contributor
Contributor

Can this same process be used to migrate an ESX VM to Server? (I'm using a trial of ESX currently and not sure if I will get the PO pushed through before the trial is over).

I'm assuming I will have to convert to COW format to use the VM on VMWare Server. Another pitfall is that the VM I would like to migrate is using 4 virtual CPUs, is that going to cause a problem with Server? I've been reading that you can't do vSMP with Server.

Reply
0 Kudos
kjb007
Immortal
Immortal

The VM itself should migrate ok. What you may want to do instead, is to run vmware converter against the VM, and create the vm as a stand-alone VM. That will give you the files on your local system. I believe, at that point, you can import them into vmware server, but I'm not sure. There is some smp support in vmware server.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
bwiechman
Contributor
Contributor

I'll look more at Converter. I haven't had time yet to get that far. I've

been trying to break ESX first...

Reply
0 Kudos