VMware Cloud Community
jamesc23
Contributor
Contributor
Jump to solution

Reclaim space on thin provisioning vmdk

Hi,

I've been running sdelete -c x:\ and migrating vmdk's between different LUN's but have been unsuccessful at reclaiming the wasted space back.  I have also tried the command vmkfstools -i disk.vmdk -d thin newdisk.vmdk within console and still have no luck with it.  Is there a more effective way of zeroing out the unused sapce rather the 2 methods mentioned?

Thank you.

0 Kudos
1 Solution

Accepted Solutions
Rubeck
Virtuoso
Virtuoso
Jump to solution

Sounds like it may be the FS3DM issue which is described here: http://kb.vmware.com/kb/2004155

Although the KB is for 4.x it looks like it may still exist in v5.x from the comments here: http://www.yellow-bricks.com/2011/02/18/blocksize-impact/

/Rubeck

View solution in original post

0 Kudos
8 Replies
Virtualinfra
Commander
Commander
Jump to solution

try doing storage vmotion with changing disk type to thin disk.

thin disk the only option to recalim the unused space.

or

Use vmware tools shrink option

refer the below link.

http://www.thelowercasew.com/reclaiming-disk-space-with-storage-vmotion-and-thin-provisioning

Award points for the helpful and correct answer by clicking the below tab Smiley Happy

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
0 Kudos
jamesc23
Contributor
Contributor
Jump to solution

Thanks.

Yes I have migrated datastore between LUN's using thin provision and the size is still the same.  I can't use vmtools to shrink because it's a thin provision vmdk.

0 Kudos
Rubeck
Virtuoso
Virtuoso
Jump to solution

Sounds like it may be the FS3DM issue which is described here: http://kb.vmware.com/kb/2004155

Although the KB is for 4.x it looks like it may still exist in v5.x from the comments here: http://www.yellow-bricks.com/2011/02/18/blocksize-impact/

/Rubeck

0 Kudos
Virtualinfra
Commander
Commander
Jump to solution

To make it clear.

Shrinking VMDK is not possible, because thin disk allow us a feature to reclaim the unused space and not shrinking the vmdk.

vmware tools shrink also helps to zeroout the disk and not reduce the size of the vmdk.

Only and easy way to reduce the size of the VMDK is to us vmware standalone convetor and do V2V, during disk size mention the required size.

Award points for the helpful and correct answer by clicking the below tab Smiley Happy

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
0 Kudos
jamesc23
Contributor
Contributor
Jump to solution

Thanks, this is exactly what I was after.  One more question before I close this discussion.

If I move a vmdk file from VMFS-5 to VMFS-3 to reclaim wasted space and then move it back to VMFS-5 LUN, would this change the vmdk file structure that was on VMFS-5 to VMFS-3 and then back to VMFS-5?  Not sure if there's such thing as VMFS-5 vmdk file but I thought I'd just throw a question in.

Thanks.

0 Kudos
Virtualinfra
Commander
Commander
Jump to solution

Yes you can do that..

As far as my understanding.

Theoretically speak make sure you know the limitation with VMFS3, when you move from vmfs5.

VMFS-3 Block size and max file size.

  • 1MB file block size - max file size is 256GB
  • 2MB file block size - max file size is 512GB
  • 4MB file block size - max file size is 1TB
  • 8MB file block size - max file size is 2TB

VMFS-5 Block size is 1 MB with max datastore size of 64TB  and Moving VMDK from VMFS 3 to VMFS5 with any size is ok, because VMFS 5 can handle larger file size.

So i would personally suggest moving vmdk from vmfs5 to vmfs3 and back to vmfs is supported, but make sure  the VMDK size is not more than 256GB.

because VMFS3 supports a larger VMDK based on the block size. you cant have 2TB VMDK with 1MB block size in vmfs3, as per the limitation.

Award points for the helpful and correct answer by clicking the below tab Smiley Happy

Thanks & Regards Dharshan S VCP 4.0,VTSP 5.0, VCP 5.0
GregorSm
Contributor
Contributor
Jump to solution

Here's how to shrink a VMDK on the ESXi 5 without VMware Converter or a spare VMFS-3 datastore with a different block size:

1. delete all unused files and folders (directories) inside the guest OS, all you can remember (Temp(s), internet browser cache, service pack and Windows Update superseded files, pagefile, ...), to gain even more free space

2. defragment the disk inside the guest, this can increase the size of the underlying virtual disk

3. zero out your disk, for instance in a Windows VM use Microsoft Windows Sysinternals SDelete 1.6:

SDelete -Z C:\

Note, that this will inflate your vDisk to full capacity. You should first check free space on VM's datastore

4. disable the FS3DM datamover easily by using vSphere PowerCLI:

Get-VM -Name "vm-to-shrink" | Get-VMHost | Set-VMHostAdvancedConfiguration -Name "VMFS3.EnableDataMovement" -Value ([int64] 0)

5. migrate your whole VM or only the vdisk to another datastore, specify thin provisioned, VMFS-5 (upgraded from VMFS-3 or made from scratch with unified 1 MB block size) is fine, storage vMotion is fine, cold disk migration is fine. Your vdisk is now shrunk

6. (optionally) migrate it back to the original datastore

7. re-enable the FS3DM datamover:

Get-VM -Name "vm-to-shrink" | Get-VMHost | Set-VMHostAdvancedConfiguration -Name "VMFS3.EnableDataMovement" -Value ([int64] 1)

This step is required because hardware offloaded data movement is preferred for all other VMDK migrations in production!

To just check the current value of the hidden ESXi advanced setting, issue:

Get-VM -Name "vm-to-shrink" | Get-VMHost | Get-VMHostAdvancedConfiguration -Name "VMFS3.EnableDataMovement"

Kind regards
Gregor


					
				
			
			
				
			
			
			
			
			
			
			
		
0 Kudos
titaniumlegs
Enthusiast
Enthusiast
Jump to solution

Sorry to jump in late.  I was looking for something else and stumbled on this.

While the method proposed is sound, I wanted to point out that VMFS block size has nothing to do with the block size the guest uses inside the VMDK.  Nor does the block size of VMFS5 restrict what you can move into VMFS3 at any block size.  Typical guest block sizes are 2k, 4k, or 8k.  Yes, there can be others as well, but they are usually much smaller than 1MB.  So, you can move a 2TB (minus 512 byte) VMDK from VMFS5 to VMFS3.  The VMFS 3 needs to be formatted one of the blocks sizes that allows the file size you need, but you're not restricted to moving from VMFS5 into a 1MB formatted VMFS3 or to the VMDK size that format implies.

Apologies if I misread your statements.

Share and enjoy! Peter If this helped you, please award points! Or beer. Or jump tickets.
0 Kudos