Tags

, , , , ,

    In a vSphere based virtualization environment we can mainly use two disk types(Thick & Thin).I hope you all know the difference between these two.

    To optimize our shared/Direct attached storage we can use thin disk. But the problem is even we delete the data from os level . It will not reclaim automatically from the storage.

    To overcome this issue we have two options.

    1. Use third party tool(if it’s a Windows we can use sdelete) to zero-out the disk blocks and using vmkfstools we can shrink the disk
    2. Storage vMotion the virtual machine or VMDK to a datastore formatted with a different block size

    In this article we are going to showcase how to use sdelete & vmkfstools to this operation

    1.This vm we have two thin disks. We will use second disk for the our test case. Capacity of the disk is 3GB

    clip_image001

    1. From the datastore we can see 80.47 GB free space

    clip_image002

    1. We have copied some files to that second disk in the vm(this is windows 7 vm).now we have only 79.65 GB free space on datastore

    clip_image003

    1. Now I’m removing data from the vm

    clip_image004

    1. But still we have only 79GB free space in our datastore

    clip_image005

    6.Now its time to use sdelete to zero-out the disk.sdelete is a free tool where we can download from microsoft site.

    clip_image006

    1. Just ran the sdelete tool(syntact sdlete.exe -z e:) .E is the drive letter

    clip_image007

    1. During this process it will consume total thin disk size from your datastore. Be careful, we should have enough space to run this tool

    clip_image008

    1. Now we can use vmkfstool to shrink the vmdk(syntact vmkfstools -K w7_1.vmdk

    clip_image009

    1. Now we can again see there is 84GB free space available

    clip_image010