VMware Cloud Community
cjamos88
Contributor
Contributor
Jump to solution

How to create VM's from templates that allow thin provisioning over NFS

Hello,

Currently running VI3.5 and Virtual Center attached to a NAS via NFS and iSCSI. How do I create a VM from a template and utilize the default thin provisioning that NFS has.

Example: When I create a windows 2003 VM with 10G C drive over an NFS datastore from scratch, thin provisioning is enabled and shows that I'm only utilizing about 4GB of the 10GB that I allocated (this is what we all expected), but when I create a VM from a template (windows 2003 10G cdrive), the NFS datastore shows that I'm using the entire 10GB for this VM. I would have expected to see the same 4GB used as the "fresh" install of windows from a cd.

So my question is: Is there a way to create VM's from templates on an NFS datstore and utilize the default thin provisioning of NFS or do I have to continue doing "fresh" installs from CD's to be able to see thin provisioning.

Any help would be appreciated.

0 Kudos
1 Solution

Accepted Solutions
pidog
Contributor
Contributor
Jump to solution

Hello,

I posted the same problem a fews months ago (using 3.0.2) and got no response. I hoped it would be corrected in 3.5, obviously it is not.

My way around this was to create the new VM from the template on local storage (or on shared NFS) and then run a script to migrate it to NFS datastore, because vmkfstools allows you to force the type of VMDK (-d thin). The script goes like this :

_________________________________________________

#!/bin/sh

#-- thin migrate from any datastore to an NFS datastore

#-- command line usage

if ; then

echo "usage : $0 vmname dstoresource dstoredest"

echo " vmname : name of VM"

echo " dstoresource : name of source datastore"

echo " dstoredest : name of destination datastore"

exit

fi

VMNAME=$1

DSTORESOURCE=$2

DSTOREDEST=$3

VMXPATH=`vmware-cmd -l | grep "/$.vmx"` SOURCE=/vmfs/volumes/$DSTORESOURCE/$VMNAME DESTINATION=/vmfs/volumes/$DSTOREDEST/$VMNAME mkdir $DESTINATION #-- unregister vmware-cmd -s unregister $VMXPATH #-- migrate from source cd $SOURCE for file in * do if (echo $file | grep "flat.vmdk"); then #-- flat vmdk file, no action : elif (echo $file | grep "vmdk"); then #-- vmdk file : thin provisionning vmkfstools -i $file -d thin $DESTINATION/$file else #-- other file : copy cp -p $file $DESTINATION fi done #-- register new location vmware-cmd -s register $DESTINATION/$.vmx

____________________________________________________

We get great space savings using this method, as we have about 30 VMs per NFS datastore. As you well know, it would be a shame not to take advantage thin partionning on NFS. The same goes for cloning : first clone anywhere, which will result in thick format event on NFS, and the use the script to thin migrate it.

--

Pierre

View solution in original post

0 Kudos
5 Replies
pidog
Contributor
Contributor
Jump to solution

Hello,

I posted the same problem a fews months ago (using 3.0.2) and got no response. I hoped it would be corrected in 3.5, obviously it is not.

My way around this was to create the new VM from the template on local storage (or on shared NFS) and then run a script to migrate it to NFS datastore, because vmkfstools allows you to force the type of VMDK (-d thin). The script goes like this :

_________________________________________________

#!/bin/sh

#-- thin migrate from any datastore to an NFS datastore

#-- command line usage

if ; then

echo "usage : $0 vmname dstoresource dstoredest"

echo " vmname : name of VM"

echo " dstoresource : name of source datastore"

echo " dstoredest : name of destination datastore"

exit

fi

VMNAME=$1

DSTORESOURCE=$2

DSTOREDEST=$3

VMXPATH=`vmware-cmd -l | grep "/$.vmx"` SOURCE=/vmfs/volumes/$DSTORESOURCE/$VMNAME DESTINATION=/vmfs/volumes/$DSTOREDEST/$VMNAME mkdir $DESTINATION #-- unregister vmware-cmd -s unregister $VMXPATH #-- migrate from source cd $SOURCE for file in * do if (echo $file | grep "flat.vmdk"); then #-- flat vmdk file, no action : elif (echo $file | grep "vmdk"); then #-- vmdk file : thin provisionning vmkfstools -i $file -d thin $DESTINATION/$file else #-- other file : copy cp -p $file $DESTINATION fi done #-- register new location vmware-cmd -s register $DESTINATION/$.vmx

____________________________________________________

We get great space savings using this method, as we have about 30 VMs per NFS datastore. As you well know, it would be a shame not to take advantage thin partionning on NFS. The same goes for cloning : first clone anywhere, which will result in thick format event on NFS, and the use the script to thin migrate it.

--

Pierre

0 Kudos
pidog
Contributor
Contributor
Jump to solution

Hi again,

Shell formatting doesn't seem to work well on rich text posts ...

The lines 1. should read as comment (#)

The first if line shoud read as if (open-bracket) $# != 3 ] ; then

Sorry about that.

0 Kudos
cjamos88
Contributor
Contributor
Jump to solution

Thank you very much...appreciate the info. Yes, I do hope this gets fixed fairly soon too.

Take care,

0 Kudos
joboo12
Enthusiast
Enthusiast
Jump to solution

Can someone from VMWare comment of this issue? I am having the same issue and would like to know if this will be addressed in a future release?

Thanks

0 Kudos
cbutters
Contributor
Contributor
Jump to solution

Rolling out a VM from a template will default to thick provisioning. This has been the case in 3.0.x as well as 3.5. I've heard rumors of a product in development to resolve the issue, but nothing in the near future.

If you want to use thin provisioning for new VMs, you need to use somesort of tool from the storage (i.e. FlexClone from NetApp).

Chris

0 Kudos