Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have an ESXi host we use for testing, which results in a ton of VMs being created and copied on a regular basis. We don't have the storage capacity to use thick provisioned VMs on this server, and have been maintaining the copies using VMWare Converter. But using the converter is an incredibly slow operation which copies the entire contents of the VM over the network several times before actually finishing the copy.

Is there a way to simply clone the VM but maintain the thin-provisioning?

share|improve this question

4 Answers 4

I get around this by making copies with the OVFtool from a command line. It isn't perfect, but it does the trick for me (note: ovftool is an app that runs on a linux system somewhere, which then connects to the ESXi host):

#Copy a VM to an OVF (must be turned off, but you can hotclone it to a new VM first if you have vCenter):
ovftool vi://USER:PASSWORD@ESXIHOSTIP/VMNAME TARGETDIR/TARGET.ovf

#Deploy an OVF to an ESX[i] server with thin disks:
ovftool --name="Name of new VM" -dm=thin -ds=TARGET-DATASTORE SOURCEFILE.ovf vi://USER:PASSWORD@ESXIHOSTIP/

You could also try ghettoCloneVM.pl, which is a tool to clone a VM on an ESX or ESXi server without vCenter (but the page says you have to have the "licensed" version of ESXi, not sure if that means the free version won't work). It looks like it has the ability to clone to a thin disk, so it might work for you. I haven't used this tool myself, but it is something to try.

share|improve this answer
    
That requires a Virtual Center or ESX license -- it doesn't work with the free version of ESXi. But +1 because it'd work if I had a license for it. –  Billy ONeal May 27 '10 at 17:31
    
@Billy ONeal, No, it works fine with the free version of ESXi. I just tested it to an ESXi box that is using the free license. –  Jed Daniels May 27 '10 at 21:22
    
Also, the ovftool can be used to deploy to VMware Server 2, which is really handy. Almost everything is the same, except the disk mode needs to be monolithicSparse to be the equivalent of thin. –  Jed Daniels May 27 '10 at 21:24
    
@Jed Daniels: Oh .. I thought you were saying run those commands on the server, which of course you can't do via ESXi. Unfortunately that method is no faster than using VMWare Converter on the VM :(. –  Billy ONeal May 28 '10 at 15:54
    
@Billy ONeal Really it isn't any faster? How big are your VMs? I can backup and re-deploy a copy of a 30GB vm in about 5 minutes (the particular OVF I'm working with now compresses down to about a gig). Additionally, this is script-able, so you don't have to sit around and wait for the converter. –  Jed Daniels May 28 '10 at 16:08

Use vmkfstools:

vmkfstools –i <sourcedisk> -d thin <targetdisk>

To use vmkfstools, you can utilize unsupported mode on the physical console, or using Remote CLI (RCLI). This document outlines how to use RCLI, with a complete section on vmkfstools alone:

vmware.com/pdf/vsphere4/r40/vsp_40_vcli.pdf

You can also use PowerCLI if you're licensed for ESXi:

$vm = get-vm "vmname"
Get-HardDisk -VM $vm | Copy-HardDisk "[Storage1]/destinationfolder" -DestinationStorageFormat thin
share|improve this answer
    
That causes the drive to become thick provisioned. –  Billy ONeal May 26 '10 at 14:16
    
How do I do that? Where do I get "vmkfstools"? It certainly didn't come with the VMWare Virtual Infrastructure client. –  Billy ONeal Jun 10 '10 at 14:53
    
It's on the ESXi server. –  amargeson Jun 10 '10 at 16:29
1  
@Billy ONeal: You can use it without using what you're deeming as "unsupported hacks" if you'd like, too. Either way results in the same outcome. Please reference the following document, which outlines how to use RCLI for ESXi. There's an entire section on how to utilize vmkfstools via RCLI. vmware.com/pdf/vsphere4/r40/vsp_40_vcli.pdf You may want to try the PowerCLI method as well, since that's by far the easiest command string. Not sure if it would work with ESXi free or not, although I would think it would not work since ESXi free supports only read only access to the API. –  amargeson Jun 29 '10 at 14:47
1  
Without a licensed version of ESXi then, guess you're out of luck if you don't want to use the command line mode in ESXi. Should you go down that path, and need the ability to do it remotely, you can enable SSH on ESXi, which would definitely fall under the realm of unsupported. Utilizing the console in ESXi entering unsupported mode I wouldn't call a hack though. You're issuing the same commands as vCLI, utilizing the same tools. Either way, good luck with it. –  amargeson Jun 30 '10 at 13:05

Are they Windows machines? I've set up a base install and sysprepped the machine. I then copy that sysprepped vmx and vmdk file into a new folder on the datastore; right-click the vmx and choose add to inventory. When I boot that machine I have a new machine... Would that work for you?

share|improve this answer
    
The copy operation causes the virtual disk to become thick provisioned. That's the entire original issue. –  Billy ONeal May 28 '10 at 15:42
    
Doh! My bad... :) –  Paul D'Ambra Jun 1 '10 at 7:51

Use PowerCLI and this:

"A powershell module to perform Storage VMotions from Thick-to-Thin. Meant to be used in place of Move-VM. Currently only accepts one VM and strings for performance reasons, will accept objects in next revision as well as more documentation."

http://poshcode.org/1579

share|improve this answer
    
PowerCLI only works for paid - for copies of ESXi. –  Billy ONeal Aug 31 '10 at 23:11
    
Can you guys get away with an essentials license? –  JakeRobinson Sep 1 '10 at 14:02
    
No. –  Billy ONeal Jan 17 '11 at 16:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.