Jump to content
Welcome to our new Citrix community!
  • 0

User Layer's VHD File is growing dynamically





I noticed that VHD file is getting larger and larger. There is a quota configured with FSRM.

When analyzing the content of the VHD File, I see that there is enough disk space available. 

So, why the VHD is growing dynamically, and how tot prevent this from happening ?





Link to comment

2 answers to this question

Recommended Posts

  • 0

This is the way NTFS works.  NTFS will always look for a contiguous block to write a file and it prefers white space to deleted space within the file system.  So if you make a VHD 10GB it will continue to use more space in the VHD even if files are deleted and that space could be used.  When it runs our pf whitespace it will then use the deleted blocks as necessary until the disk actually runs out of space.


You can use diskpart to "compress" the disk and return the deleted space back to the underlying storage.  The commands are:


Select vdisk FILE="\\zdc2\Unidesk\Users\ZYLOWSKI_rzylowski\4968002_Win10-1909\rzylowski.vhd"
attach vdisk readonly
compact vdisk
detach vdisk

The disk must not be in use to run the commands.


I have a new version of my User Layer Repair utility that includes compression.  It will allow you to perform the compression on selected vdisks or all.  It will also include a script you can run in a scheduled task to compress the vhds.   I will try to remember to come back here and post when i have posted the new version on Citrix Blogs.

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...