Virtualization Pro

Jan 27 2009   7:44PM GMT

Three ways to temporarily move VMs off a VMware ESX host

Eric Siebert Eric Siebert Profile: Eric Siebert

I recently came across an ITKE question from a user that had some virtual machines (VMs) on an ESX host. He wanted to move the VMs off of it so he could reconfigure the server with more storage, reinstall ESX and then move the VMs back on to it. Presumably he only had one ESX host with only local disk. There are several options for accomplishing what he wanted to do.

First, you need to find alternate storage to place the VM’s on. This could be a workstation, a Windows or Linux server or an NFS/iSCSI storage device with enough free space to temporarily hold the VMs. Once you find your temporary home, there are several methods that you can use to move the VMs.

Method 1: Create a network-based data store

The first method is the simplest and involves creating a network-based data store on the ESX host. You can do this with a network file system (NFS) or by using a software iSCSI initiator. If you have a Windows or Linux server that supports NFS, you can create a NFS share and then map your ESX host to it to use as a data store by creating a new data store. You can also setup one of the open-source iSCSI appliances like OpenFiler to use as a data store for your ESX host. Once you have a new data store you simply shut down the VMs and use the service console command-line tools to move the VM to the new data store. The vmkfstools –i command will allow you to clone the VMs disk to another VMFS datastore. Then, after you copy the VMs disk to the new data store, you simply add the data store back to the newly rebuilt ESX host and use vmkfstools –i to copy the disk back to it and create a new VM, and tell it to use an existing disk.

Method 2: Use VMware Converter

Another method is to use VMware Converter to migrate the VM to a local workstation or network drive. To do this just install Converter on the VM, choose to convert the local server, and for the destination choose “Other Virtual Machine.” You can then select a network path to store the new VM. It’s a good idea to resize the VM so there is less data to transfer; you can always resize it back to its original size when you move it back to the ESX host.

Method 3: Use a secure copy (SCP) file transfer utility

Finally, the last method is to use one of the secury copy (SCP) file transfer utilities to copy the VM’s files to a local workstation or network drive. FastSCP works best for this. It copies data the fastest because it does not encrypt the data being copied. Then you simply copy the data back to the host after it is rebuilt and either re-register the VM or create a new one and tell it to use an existing disk.

Once you copy virtual disks to an ESX host it’s always a good idea to clone them before using them using vmkfstools as it allocates all the disk space at once which results in a disk with less fragmentation. Tools like FastSCP only allocate space as the data is copied which can result in more fragmentation of the virtual disk file. To clone a disk with vmkfstools just type vmkfstools –i . Once the cloning process completes you can remove the existing disk from the VM and add a new one and browse to the newly created virtual disk.

Whichever method you choose, make sure you have a good backup of the VM before starting.

3  Comments on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.
  • Tlyczko
    Can this be used to resize a VM's C: drive to be smaller, to say, 20-25 GB from 30 GB?/ Thank you, Tom
    20 pointsBadges:
  • vanzylw
    Yes Converter can be used to do this along with some other methods, read more here: [A href=",289483,sid179_gci1322236,00.html"]Using VMware Converter to resize virtual disk files (Pt. 1)[/A] [A href=",289483,sid179_gci1324177,00.html"]Increasing virtual disk partition size using DISKPART or GpartEd (Pt. 2)[/A]
    0 pointsBadges:
  • Tlyczko
    Wow, Eric, that was fast. I've done increasing before with GParted, it works nicely. I'll have to backup and clone the VM with Converter to reduce its drives' sizes. Thank you, Tom
    20 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: