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

My Subscriptions

Loading

Knowledge Base

Cloning Individual Virtual Machine Disks via vMA and vCLI (1027872)

Last Updated: 3/20/2024Categories: How toTotal Views: 30600Language:
Chinese (Simplified)JapaneseEnglish

Subscribe to get an email
newsletter with new updates

Please provide article feedback:

Purpose

This article provides basic instructions for cloning individual virtual machine disk files using the VMware vSphere Management Assistant (vMA) and the vSphere CLI (vCLI).

Note: The context of the instructions will change, depending on whether the virtual machine has existing snapshots, or not. If the virtual machine has snapshots or delta disks, refer to the appropriate instructions included below. Both scenarios are covered in this article.

Resolution

Note: The virtual machine does not need to be powered off for these operations.

Cloning a virtual machine disk without delta files or snapshots
To clone a virtual machine disk using the vMA or vCLI:

Start the vMA and log in. If this is your first time starting the appliance, complete the setup process. Proceed to the next step if you are using the vCLI.

Run the following command to list the affected virtual machine's directory content, similar to the following image:

vifs --server -D '[Datastore Name] examplevm'

Determine what datastore you will be cloning the virtual disk in question to. Refer to the reports provided by your VMware vSphere or Infrastructure client for capacity and usage information of your datastores. You will require enough space at the destination for a clone of the virtual machine's base disk.

Create a new destination directory, if it does not exist already:

vifs --server -M '[Datastore Name] Example Directory'

Verify the created directory (e.g. 'Example Directory') exists:

vifs --server -D '[Datastore Name]'

Run the following command to clone the virtual machine disk. Specify the descriptor file, as opposed to the flat.vmdk extent file:

vmkfstools --server -i '[Datastore Name] examplevm/examplevm.vmdk' '[Datastore Name] Example Directory/examplevm-clone.vmdk'

Note: A progress indicator is not displayed for this task in the vMA or vCLI. When the task is complete, you will be returned to the prompt.

You may review the results using: vifs --server -D '[Datastore Name] Example Directory'

Repeat the clone process for each additional virtual machine disk, if necessary.

Add the cloned virtual machine disk to a virtual machine's hardware configuration to access its stored content.

Cloning a virtual machine disk with delta files or snapshots
To clone a snapshotted virtual machine disk using the vMA or vCLI:

Start the vMA and log in. If this is your first time starting the appliance, complete the setup process. Proceed to the next step if you are using the vCLI.

Run the following command to list the affected virtual machine's directory content, similar to the following image:

vifs --server -D '[Datastore Name] Example Directory'

Note: The virtual machine examplevm, in this case, has three snapshots or delta disks, based on the existence of examplevm-000001.vmdk, examplevm-000002.vmdk, and examplevm-000003.vmdk files. If this virtual machine had additional virtual hard disks, there would be an additional three snapshots for each disk.

Determine what datastore you will be cloning the virtual disk in question to. Refer to the reports provided by your VMware vSphere or Infrastructure client for capacity and usage information of your datastores. You will require enough space for a clone of the virtual machine's base disk. For example, examplevm.vmdk is 20GB, where the three snapshots are approximately 10GB each. The destination only requires 20GB of free space.

Create a new destination directory, if it does not exist already:

vifs --server -M '[Datastore Name] Example Directory'

Verify the created directory exists:

vifs --server -D '[Datastore Name]'

Run the following command to consolidate the delta disk and its parent files into a single destination file. Specify the descriptor file, as opposed to the delta.vmdk extent file:

vmkfstools --server -i '[Datastore Name] examplevm/examplevm-000003.vmdk' '[Datastore Name] Example Directory/examplevm_consolidated.vmdk'

Note: A progress indicator is not displayed for this task in the vMA or vCLI. When the task is complete, you will be returned to the prompt.

Repeat the clone process for each additional snapshotted virtual machine machine disk, if necessary. For example if you have consolidated a sizable amount of delta information and no longer require additional space to consolidate the other virtual hard disks, you may consider further clones may not be necessary.

Modify the virtual machine's configuration and remove the virtual hard disk that was just cloned.

Note: Remove the disk from the virtual machine's configuration, as opposed to removing it and deleting the files from the datastore. These options are presented to you upon removal, on the right-side of the configuration applet.

Add the cloned virtual machine disk to the virtual machine's configuration.

Select the virtual machine and click Edit Settings.

Select the Add... button above the virtual hardware list.

Select Hard Disk and Use an existing virtual disk in the following step.

Complete the remainder of the wizard, locating the destination datastore and disk that you have consolidated into, or cloned, in step 5.

After completing the wizard, confirm that the appropriate SCSI Controller type is selected, then finalize and apply the configuration by clicking OK.

Confirm you have sufficient space to start the virtual machine. For more information, see: Verifying sufficient free disk space for an ESX/ESXi virtual machine (1003755). Start the virtual machine and verify the guest operating system and contained file systems are healthy.

In the event that you see noticeable file system damage, corruption, or appears out of date, review the steps provided in this article and ensure:

You have referenced the correct virtual machine snapshot or delta point to clone from.

You have selected the cloned disk to boot with, as opposed to the original virtual machine base disk, or otherwise.

Otherwise it may be possible that the delta disk point referenced is corrupt and you must revert to an earlier snapshot point. You may accomplish this by:

Removing the cloned virtual disk from the virtual machine configuration (and opting to delete the disk from the datastore)

Then create a new disk clone from examplevm-000002.vmdk, an earlier snapshot point than examplevm-000003.vmdk, to the datastore.

Add the newly created clone to the virtual machine's configuration.

Rename the virtual machine's snapshot database file. We have altered the snapshot layout for the virtual machine by replacing disks in the configuration and it is now invalid:

vifs --server 10.21.49.14 -m '[Storage1 (3)] examplevm/examplevm.vmsd' '[Storage1 (3)] examplevm/examplevm.vmsd.old'

Finally, verify that the virtual machine guest operating system starts successfully.

If the virtual machine starts and the guest file systems appear intact, remove the old virtual machine disk files, per the Additional Information section of the following article: Consolidating snapshots (1007849).

Related Information

For more information on vMA and vCLI, see:

VMware Communities: vSphere Management Assistant (vMA)

VMware Communities: vSphere Command-Line Interface (vCLI)

For more information on snapshot consolidation, see Consolidating snapshots in ESX/ESXi 3.x and 4.x (1007849).Consolidating snapshots in ESX/ESXi 3.x and 4.x
通过 vMA 和 vCLI 克隆单个虚拟机磁盘
vMA および vCLI による個々の仮想マシン ディスクのクローン作成

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
Chinese (Simplified)JapaneseEnglish

Attachments

Additional Resources

KB
•
Windows 2008 R2 虚拟机的“摘要”选项卡报告 VMware Tools 处于“未运行 (当前)”状态 (2063887)

KB
•
A operação do vCenter atinge o tempo limite com o erro: Operação falhou porque há outra tarefa em execução (1004790)

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

Results 1-3 of 3

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere Management Assistant

VMware vSphere ESXi

VMware vSphere CLI

VMware vSphere

VMware VirtualCenter

VMware vCenter Server

VMware ESX Server

Related Versions:

VMware vSphere Management Assistant 5.5

VMware vSphere Management Assistant 5.1

VMware vSphere Management Assistant 4.0.x

VMware vSphere ESXi 5.5

VMware vSphere ESXi 5.1

VMware vSphere ESXi 5.0

VMware vSphere CLI 4.0

VMware VirtualCenter 2.5.x

VMware vCenter Server 4.1.x

VMware vCenter Server 4.0.x

VMware ESXi 4.1.x Installable

VMware ESXi 4.1.x Embedded

VMware ESXi 4.0.x Installable

VMware ESXi 4.0.x Embedded

VMware ESXi 3.5.x Installable

VMware ESXi 3.5.x Embedded

VMware ESX Server 3.5.x

VMware ESX 4.1.x

VMware ESX 4.0.x

view all

Take Our Survey

Support Assistant