Knowledge Base

Search the Knowledge Base:

Products:
Search In:
 

Moving Virtual Disks to or from ESX Server

Details

How do I move virtual disks to or from ESX Server?

Solution

You might want to move VMware ESX Server virtual disk files to or from a VMFS volume for:

  • Cloning or migrating a virtual machine to a different server.
  • Backing up a virtual machine.
  • Converting a virtual disk to be used with a different VMware platform product.

For moving ESX Server virtual disk files, note that:

  • ESX Server uses a proprietary file system called VMFS. VMFS is designed for high speed access and large file sizes.

  • Virtual disks in ESX Server are always contained in a single file, whereas VMware GSX Server and VMware Workstation may use one or more files to represent a single virtual disk.

  • ESX Server virtual disk files are always preallocated to their full size.

  • Some file systems (for example, VFAT or EXT2) cannot store files larger than 2GB. If you move an ESX Server virtual disk to such a file system, you must convert the disk to a multi-file format used by GSX Server and Workstation.

  • ESX Server versions previous to the 2.5 release use a default file name extension of .dsk for virtual disks, whereas GSX Server and Workstation use .vmdk. (VirtualCenter, however, creates VMFS disk files with a .vmdk extension.)
For a more complete discussion on backing up ESX Server virtual machines, refer to http://kb.vmware.com/kb/1355.
Please also refer to the Virtual Machine Mobility Guide http://www.vmware.com/pdf/mobility_guide.pdf.

The tools you can use to move virtual disks include:

  • VMware Virtual Machine Importer 2
  • VMware VirtualCenter
  • VMware Management Interface
  • SCP
  • FTP
  • vmkfstools

Moving Virtual Disks with VMware Virtual Machine Importer 2

For ESX Server 3.x and VirtualCenter-managed ESX Server 2.5.x virtual machines, you can use VMware Virtual Machine Importer 2 to migrate virtual machines to and from ESX Server. Virtual Machine Importer 2 is a freely available, stand-alone utility to import virtual machines from a variety of source formats into most VMware product environments.

To obtain the free download of Virtual Machine Importer 2, go to http://www.vmware.com/products/vmimporter/

To install and use Virtual Machine Importer 2, follow the instructions in the user's manual: http://vmware.com/pdf/vmi20_manual.pdf
Supported Virtual Machine Destinations
  • VMware Workstation 4.x virtual machine (compatible with VMware GSX Server 3.x, ESX Server 2.5.x)
  • VMware Workstation 5.x virtual machine (compatible with VMware Player and VMware Server 1.0)
  • VMware ESX Server 2.5.x (when managed by VirtualCenter 2.0)
  • VMware ESX Server 3.0 (when managed by VirtualCenter 2.0)
  • VMware ESX Server 3.0 (standalone)
Supported Guest Operating Systems

The following 32-bit guest operating systems are fully supported by Virtual Machine Importer 2:

  • Windows NT
  • Windows 2000 Professional
  • Windows 2000 Server
  • Windows XP Professional
  • Windows 2003 Server

Support for the following guest operating systems is Experimental. VMware Virtual Machine Importer 2 can clone source images containing these operating systems, but the destination virtual machine may or may not work without additional configuration after import. In particular, if the source image contains unsupported hardware, you may need to modify the configuration of the destination virtual machine before using it:

  • Linux
  • Windows NT 3.x
  • Windows ME
  • Windows 98
  • Windows 95
  • MS-DOS
  • 64-bit guest operating systems

For operating systems and ESX Server versions not supported by Virtual Machine Importer 2, the remaining sections detail how to move virtual machines.

Moving Virtual Disks with VMware VirtualCenter

VirtualCenter specializes in migrating complete virtual machines, warehousing large numbers of virtual machines, and cloning virtual machines from templates. VirtualCenter is recommended for managing many virtual machines in an enterprise environment.

SCP and recent versions of FTP, unlike some other file utilities, are capable of handling files larger than 2GB. You can safely use these tools to move ESX Server virtual disks to other VMFS volumes, or to back them up on file systems capable of handling files over 2GB. However, be sure to use binary mode when transferring virtual disk files with FTP. VMware recommends that you use md5sum or a similar utility to verify file integrity after copying a virtual disk.

Note: VMware does not support the use of virtual machine disk files moved from a VMFS volume to a non-VMFS file system by SCP or FTP. When you move a virtual machine disk file to a non-VMFS file system without using the vmkfstools export command or the file manager in the VMware Management Interface, the resulting disk file is completely corrupted and is rendered unusable. This is because the file format is completely different and a non-VMFS file system does not understand how to handle a file created under a VMFS file system.

The VMware Management Interface and the vmkfstools utility are able to convert virtual disk files from the ESX Server VMFS file system format to formats compatible with other VMware products, and to store the disk files on non-VMFS file systems. These tools can be used to migrate virtual machines between ESX Server and other virtual platform products, or to file systems that limit file size to 2GB.

Moving Virtual Disks with the VMware Management Interface

To use the file manager in the VMware Management Interface, click the Manage Files link to open a window showing a directory tree on the left and the current directory contents on the right. You can expand or collapse parts of the directory tree by clicking on the folder icons at the left.

To do file operations in the current directory, click the check boxes to select files in the current directory listing at the right. Then use the Delete, Edit Properties, Cut and Copy buttons at the bottom to perform file-level operations on the selected files. Refer to the ESX Server documentation for more complete information on using the file manager.

For example, to export a virtual disk using the file manager:

  1. Click the Manage Files link in the upper right corner of the management interface. A new window opens, showing a tree view of directories on the left, and the current directory on the right.

  2. Navigate to the directory containing the virtual disk you want to move.

  3. Check the box next to the icon for the virtual disk.

  4. Click the Copy or Cut button at the bottom of the File Manager window.

  5. Navigate to the destination directory and click the Paste button at the bottom of the File Manager window.

The file manager automatically determines when to convert between virtual disk formats. If you are moving a virtual disk from a VMFS volume to a different file system, the file is converted to a number of 2GB files which can safely be stored on all popular file system types. The destination file system can be an NFS or Samba mount, as well as a local EXT2 or EXT3 file system.

Note: VMware does not recommend exporting or importing virtual disk files to or from network shares, as the resulting files may be corrupted by network errors. It's better to use vmkfstools to move virtual disk files between a VMFS and a local file system in one step, and use FTP or SCP to move virtual disk files between the local file system and the network share in a separate step.

Exporting ESX Server Virtual Disk Files to Non-VMFS File Systems

Follow these steps to back up virtual disk files created with ESX Server to non-VMFS file systems, or to convert ESX Server virtual disks to a format that can be used with GSX Server and Workstation:

  1. Ensure that the service console file system has enough room to hold the entire virtual disk. If not, use Samba or NFS to mount a remote directory that does.

  2. At the command line, enter one of the following.

    For ESX Server 2.5.x and earlier:

    vmkfstools -e <folder>/<filename>.vmdk <vmhba number>:<filename>.dsk

    <folder> is the name of the folder to which you are exporting.
    <filename> is the name of the file you are exporting.
    <vmhba number> is the name of the VMFS partition.

    For example:

    vmkfstools -e /mnt/bigserver/putfileshere/mydisk.vmdk vmhba0:0:0:1:mydisk.dsk

    For ESX Server 3.0.x:

    vmkfstools -i /path/to/src/src.vmdk -d 2gbsparse /path/to/dest/dest.vmdk

    /path/to/dest should already exist and should not contain dest.vmdk (or it will get overwritten).

    Notes:

    • The ESX Server shell requires a backslash to escape each colon in the vmhba number and filename separator if you specify vmfs in the path, as shown in the following example:

      /vmfs/vmhba0\:0\:0\:1\:mydisk.dsk

    • ESX Server 2.5 may use a .vmdk filename extension, so the file name following the vmhba number in the examples shown here might instead appear as vmhba0:0:0:1:mydisk.vmdk.

The vmkfstools command creates 2GB files on non-VMFS file systems, in the same way that the management interface file manager does.

Importing GSX Server and Workstation Virtual Disks to ESX Server

 
Follow these steps to convert virtual disks created with GSX Server and Workstation to virtual disks that can be used with ESX Server.
 
Note: You can migrate only a virtual machine created with virtual SCSI disks to an ESX Server system. ESX Server will not recognize the virtual IDE disks. If you have P2V Assistant, you can use this tool to convert the virtual machine from IDE to SCSI. Also see Converting a GSX Server Virtual IDE Disk to a Virtual SCSI Disk (http://kb.vmware.com/kb/1881).
  1. Make sure the .vmdk file or files are accessible from the service console.

  2. At the command line, enter:

    vmkfstools -i <folder>/<filename>.vmdk <vmhba number>:<filename>.dsk

    <folder> is the name of the folder from which you are importing.
    <filename> is the name of the file you are importing.
    <vmhba number> is the name of the VMFS partition.

    For example:

    vmkfstools -i /mnt/bigserver/putfileshere/mydisk.vmdk vmhba0:0:0:1:mydisk.dsk

    Note on preallocated disks: If the virtual disk that you are importing is a preallocated disk, you'll have two .vmdk files that look something like this:

    -rw-r--r-- 1 root root 10737418240 Dec 20 23:14 win2k3-gsx-flat.vmdk
    -rw-r--r-- 1 root root 351 Dec 20 21:13 win2k3-gsx.vmdk

    Run vmkfstools on the smaller file -- the one that does not include "flat" in its file name. In the example above, the correct file to choose is win2k3-gsx.vmdk.

You can find additional information on using the vmkfstools utility in the ESX Server documentation.
 

Keywords

900; urlz; virtual; center; vmfstool; vc; virtualcenter; copying; migrate; VM; Invalid response code: 400 Bad Request; virtual machine moving; vmdk; migrating; importing; exporting

Feedback

Rating: 1 - Lowest 2 3 4 5 - Highest (3 Ratings)   

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (2000 or fewer characters)
Submit
Rating: 1 - Lowest 2 3 4 5 - Highest (3 Ratings)   
Actions