VMware Cloud Community
hostasaurus
Enthusiast
Enthusiast
Jump to solution

How to shrink thin guest on VMFS5? or change block size?

Hi all, I'm trying to find a way to shrink bloated thin-provisioned guests in an all VMFS5 environment.

We upgraded from 4.1 to 5.1 and then also storage vmotioned all of our vm's to newly created VMFS5 volumes before deleting the old VMFS3 volumes.  While doing this, everyone forgot that one of our volumes was intentionally set to a differnet block size than all the others for the purposes of shrinking guests that had ballooned up for whatever reason.  Now we have no way to create anything but a 1 MB block size volume which prevents us from doing the cleanup routine.  Is there any alternative way to shrink a guest that does not involve taking it offline?

For those not familiar with the procedure I'm describing, here's how it works:

Say you have a 100 GB guest that only has 10 GB of real data in it  but due to something having gone wrong, temporary files, clean-up of old data performed,  etc., that 100 GB had been used at one point by real files but is now only 10 GB in use. You would like to recover what is now 90 wasted gigs of space since your thin-provisioned VMDK is sitting there at 100 GB in size.  With VMFS3, you could create a volume with a  block size that was different than the volume the guest currently lives  on.   In our environment all of our LUN’s were 1 MB except for one we  kept at 2 MB just for this purpose.   When we were getting a bit low on  space and found guests like the one in question, we’d run a simple  command to write zeroes to all of the free space:

cat /dev/zero > bigfile ; rm -f bigfile

Then all you have to do is storage vMotion the guest to the 2 MB  volume and back to its normal home and suddenly the VMDK goes from 100  gigs down to 10 gigs, all without any impact on the guest.  Without support for creating a file system with a different block  size in VMFS5, now I am not aware of a way to reclaim this space in a manner that doesn’t  require an outage for the guest.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

You can select the VMFS version when you create a new datastore. With VMFS3 selected, you will be able to specify the desired block size.

André

View solution in original post

0 Kudos
5 Replies
a_p_
Leadership
Leadership
Jump to solution

With just new VMFS5 volumes you may be limited to offline shrinking (i.e. vmkfstools --punchzero). However, an online option might be to create an additional VMFS3 datastore for this purpose.

André

0 Kudos
hostasaurus
Enthusiast
Enthusiast
Jump to solution

Do you know if there's a way to create one from vCenter/ESXi 5.1?  Or do I need to install a 'new' 4.1 server and hook it to the san just to create the file system?

Thanks!

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

You can select the VMFS version when you create a new datastore. With VMFS3 selected, you will be able to specify the desired block size.

André

0 Kudos
hostasaurus
Enthusiast
Enthusiast
Jump to solution

Doh!  That was stupid of me, I breezed through the volume create wizard so many times setting up the new LUNs that I completely overlooked the fact that you're allowed to still create VMFS v3 volumes.  I'll set one up just for this maintenance task and problem solved.

Thanks!

(Still wish there was a specific shrinking process that could be run on a live vm)

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

(Still wish there was a specific shrinking process that could be run on a live vm)

You are not alone Smiley Wink

André

0 Kudos