Loading

×Sorry to interrupt
CSS Error

Refresh

Cookie Preference Center

General Information on cookies

When you visit our website, we use cookies to ensure that we give you the best experience. This information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience on the site and the services we are able to offer. Further information can be found in our

Cookie Policy.

Strictly Necessary

Strictly Necessary

Always Active

Strictly Necessary

Strictly necessary cookies are always enabled since they are essential for our website to function. They enable core functionality such as security, network management, and website accessibility. You can set your browser to block or alert you about these cookies, but this may affect how the website functions. For more information please visit www.aboutcookies.org or www.allaboutcookies.org.

Cookie Details‎

Performance

Performance

Performance

Performance cookies are used to analyze the user experience to improve our website by collecting and reporting information on how you use it. They allow us to know which pages are the most and least popular, see how visitors move around the site, optimize our website and make it easier to navigate.

Cookie Details‎

Please confirm your settings by refreshing the page.

Functional

Functional

Functional

Functional cookies help us keep track of your past browsing choices so we can improve usability and customize your experience. These cookies enable the website to remember your preferred settings, language preferences, location and other customizable elements such as font or text size. If you do not allow these cookies, then some or all of these services may not function properly.

Cookie Details‎

Advertising

Advertising

Advertising

Advertising cookies are used to send you relevant advertising and promotional information. They may be set through our site by third parties to build a profile of your interests and show you relevant advertisements on other sites. These cookies do not directly store personal information, but their function is based on uniquely identifying your browser and internet device.

Cookie Details‎

Advertising Cookies

Consent Leg.Interest

Select All Vendors

Select All Vendors

Select All Hosts

Select All

Clear Filters

Information storage and access

Apply

Confirm My Choices Reject All Allow All

Skip to main content

Products and Accounts

Support

Knowledge

Communities

Success

Learning

My Subscriptions

Loading

Knowledge Base

Moving or copying a virtual machine within a VMware environment (1000936)

Last Updated: 2/28/2024Categories: How toTotal Views: 1031699Language:
Chinese (Simplified)Portuguese (European)JapaneseSpanishEnglish

34 like this article

Subscribe to get an email
newsletter with new updates

34 people found this helpful Please provide article feedback:

Learn how VMware Skyline Advisor and Skyline Health Diagnostics work together to provide proactive intelligence and self-service log analysis.

Use Skyline Advisor to avoid issues before they occur across VCF, vSphere, vSAN, NSX, vROps & Horizon. Skyline Findings are based on top KBs, VMSAs/CVEs and design best practices.

Use Skyline Health Diagnostics to root cause vSphere & vSAN logs when an issue occurs. Skyline Health Diagnostic Findings are based on top KBs and VMSA/CVEs. You can use the Skyline Health Diagnostics tool in online or offline mode.

If you require additional help from technical support, please use Skyline Advisor to initiate a Log Assist to reduce time to upload logs. TSEs can also initiate logs to reduce effort.

Details

In certain circumstances you may want to relocate a virtual machine from one location to another location. These circumstances may include, but are not limited to, the following:

Moving a virtual machine from a platform using one VMware product to a different platform using another VMware product.

Troubleshooting issues involving high disk space usage.

Balancing disk space usage.

Cloning a virtual machine.

Backing up a virtual machine.

This article explores and describes different methods of relocating virtual machine files within your VMware environment.

Solution

Existing VMware Products and Features

Prior to manually moving or copying virtual machine disk files, consider using existing VMware features which can accomplish similar desired results. These VMware features include:

Converting virtual machines with VMware Converter. For more information, see the VMware Converter Standalone Documentation.

Converting virtual machines with VMware vCenter Converter. For more information, see the VMware vCenter Converter Administration Guide for your VMware product version.

Live Migrate, Cold Migrate, Clone, or Storage vMotion with VMware vCenter or VMware VirtualCenter. For more information, see the Migrating Virtual Machines in the Basic System Administration Guide for your VMware product version.

Backing up virtual machines with VMware Consolidated Backup. For more information, see the Virtual Machine Backup Guide for your VMware product version.

Considerations and Caveats

The following are several caveats specific to moving or relocating virtual machine disk files:

Different versions of VMware products may have different implementations of a virtual disk file.

When using snapshots, a virtual machine's virtual disks can be comprised of multiple VMDK files which are part of an interdependent chain. For more information, see Disk Chaining and Redo Logs in the Virtual Disk API Programming Guide.

To prevent performance and data management related issues on ESX, avoid the use of using scp, cp, or mv for storage operations; instead use vmkfstools, VMware's virtual machine Importer tool. For more information regarding the usage of tools within the service console, see Third-Party Software in the Service Console.

To avoid any potential issues involving snapshots and inconsistent disk chains, ensure that the virtual machine does not have any snapshots. Moving virtual machines with snapshots is outside of the scope of this article, and VMware strongly recommends using one of the alternate methods described above.

You must know exactly where the virtual disk file you want to move is located, and you must ensure that the virtual machine is powered off.

Copying or moving the virtual machine and virtual disks

Follow these high-level steps to move a virtual machine to an alternate location:

Select the virtual machine.

Commit all snapshots on the virtual machine. For more information, see Committing snapshots from within the Service Console (1006847).

Identify the working directory of the virtual machine.

Identify the location of all virtual disks.

Power off the virtual machine.

Create a folder for the copy of the virtual machine.

Copy the virtual machine configuration file ( .vmx) to the new folder.

Copy the virtual disks to the new folder. For more information, see Moving or Copying Virtual Disks in a VMware Environment (900).

Register the new virtual machine.

Add the virtual disk copies to the virtual machine copy.

Upgrade the virtual hardware if necessary.

Power on the virtual machine.

Test the new virtual machine.

Optionally, delete the original virtual machine files.

Note: For more information about performing these general steps, see Commands for ESX and ESXi and Commands for VMware Server and VMware desktop products in this article.

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

Creating a new virtual machine instead of copying the original virtual machine configuration file has advantages. By creating a new virtual machine, you do not have to create folders, upgrade the virtual machine hardware, or register a virtual machine.

Follow these high-level steps to recreate a virtual machine in an alternate location:

Select the virtual machine.

Make note of the networking, memory, and CPU configuration of the virtual machine.

Commit all snapshots on the virtual machine. For more information, see Committing snapshots from within the Service Console (1006847).

Identify the location of all virtual disks.

Power off the virtual machine.

Remove virtual disks.

Warning: Do not delete the virtual disk.

Create a new virtual machine and recreate the configuration identified in step 2.

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

Add the virtual disk copies to the new virtual machine.

Power on the new virtual machine.

Test the new virtual machine.

Optionally, delete the original virtual machine files.

Note: For more information about performing these general steps, see Commands for ESX and ESXi and Commands for VMware Server and VMware desktop products in this article.

Commands for ESX and ESXi

The steps to create a copy a virtual machine to a new location or recreate a virtual machine in an alternate location are different for ESX and ESXi.

For specific instructions to perform the following tasks, see the appropriate product documentation:

Power on the virtual machine

Power off the virtual machine

Remove virtual disks

Upgrade the virtual hardware

Adding virtual disks

Warning: In certain situations, you may want to run some of the above steps via the command line or service console. To support certain internal operations, ESX installations include a subset of standard Linux configuration commands (for example, network and storage configuration commands). Using these commands to perform configuration tasks can result in serious configuration conflicts and render some ESX functions unusable. Always work through the vSphere Client when configuring ESX, unless otherwise instructed in vSphere documentation or by VMware Technical Support.

Registering a virtual machine

To register a virtual machine from the ESX Service Console, run the command:

vmware-cmd <cfg> register, where <cfg> is the full path to the vmx file

where <cfg> is the full path to the .vmx file

In Versions ESXi 4.1, 5.0, 5.1 and 5.5 vmware-cmd is no longer a valid command .vCLI (vSphere CLI) will have to be installed. Please see the following link for more information:

Overview of vSphere Command-Line Interfaces

To register a virtual machine from ESXi and thevSphere CLI, run the command:

vmware-cmd.pl -H <host> -U <username> -P <password> <cfg> register

where <cfg> is the full path to the .vmx file

In ESXi 5.x, use this command to register the virtual machine:

vmware-cmd.pl -H <vc_server> -U <login_user -P <login_password --vihost <esx_host> -s register /vmfs/volumes/Storage2/testvm/testvm.vmx

Note: The system returns 0 to indicate success, 1 to indicate failure.

Identifying the working directory

To identify the working directory of the virtual machinefrom the ESX Service Console, run the command:

vmware-cmd -l

To identify the working directory of the virtual machinefrom ESXi and the vSphere CLI, run the command:

vmware-cmd.pl -H <host> -U <username> -P <password> -l

Identifying the location of all virtual disks

To identify the location of all virtual disks from the ESX Service Console, run the command:

grep -i vmdk <cfg>

where <cfg> is the full path to the vmx file

Creating a folder for the copy of the virtual machine

To create a folder for the copy of the virtual machine from the ESX Service Console, run the command:

mkdir /vmfs/volumes/<datastore>/<dir>

where <datastore> is the desired datastore, and <dir> is the desired directory name</dir></dir>

To create a folder for the copy of the virtual machine from ESXi and the vSphere CLI, run the command:

vifs.pl -H <host> -U <username> -P <password> --mkdir '[datastore] dir'

where datastore is the name of the datastore, and dir is the name of the new directory

Copying the virtual machine configuration file to the new folder

To copy the virtual machine configuration ( .vmx) file to the new folder from the ESX Service Console, run the command:

cp <source> <destination>

where <source> is the full path of the virtual machine configuration file, and <destination> is the desired location for the .vmx file.

To copy the virtual machine configuration file to the new folder from ESXi and the vSphere CLI, run the command:

vifs.pl -H <host> -U <username> -P <password> --copy '[src datastore] <src dir>/<vmx>' '[dst datastore] <dst dir>/<vmx>'

where:

src datastore and dst datastore are the source and destination datastores

<src dir> and <dst dir> are the source and destination directories

<vmx> is the name of the . vmx file

Notes:

For more information about using the vSphere Command-Line Interface, see vSphere Command-Line Interface Documentation.

For more information about ESX specific commands, see the Appendices of theESX Server Configuration Guidefor your VMware product version.

Copying virtual disk files across the network to and from different platforms

Moving virtual disk files across a network can be accomplished in many ways and on many platforms. Here are several options to transport files across to different platforms:

FTP file transfer

SCP file transfer

NFS shares

Windows File Sharing (CIFS shares)

Steps on how to enable, configure, and transfer files using these specific methods are outside of the scope of this article. When transferring virtual disk files across the network, VMware recommends validating the information before and after the file transfer. This can be done by using MD5 checksums. For more information about MD5 checksums, please see Using MD5 Checksums.

Additional Information:

For translated versions of this article, see:

Spanish Mover o copiar una máquina virtual dentro de un entorno de VMware (2016356)

Portuguese Movendo ou copiando uma máquina virtual em ambiente VMware (2014495)

Japanese VMware 環境内での仮想マシンの移動またはコピー (2052811)

简体中文: 在 VMware 环境中移动或复制虚拟机 (2086069)

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
Chinese (Simplified)Portuguese (European)JapaneseSpanishEnglish

Attachments

Additional Resources

KB
•
End Of General Availability of the Free vSphere Hypervisor (ESXi 7.x and 8.x) (2107518)

KB
•
Download and Install VMware Fusion (2014097)

Results 1-2 of 2

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere ESXi

VMware ESX Server

Related Versions:

Take Our Survey

Was this article helpful?

YES

NO

Copyright © 2005-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.

Terms of Use

Your California Privacy Rights

Privacy

Accessibility

Cookie Settings

Support Assistant