Configure VHD settings
This article shows you how to customize and optimize VHDX-based features:
-
Specify the storage capacity and path for VHD containers
Applies to: profile containers, OneDrive containers, folder mirroring containers, and Outlook search index containers.
-
Enable and configure VHD disk compaction settings
Applies to: profile containers, OneDrive containers, and folder mirroring containers
-
Enable exclusive access to VHD containers
Applies to: profile containers and OneDrive containers
-
Enable automatic reattachment of VHDX disks in sessions
Applies to: profile containers, Outlook search index containers, folder mirroring containers, and OneDrive containers.
For more information about these containers see:
-
Outlook search index roaming (called Outlook search index container)
-
Accelerating folder mirroring solution (called folder mirroring container)
Specify the storage capacity and path for VHD containers
By default, each VHDX container is stored in the user store with a disk capacity of 50 GB. If needed, you can choose a different storage path for it and change its default capacity.
The following lists the default and custom storage paths of VHDX files:
- Profile container settings
- Default: {USER_STORE_PATH}\ProfileContainer\{OS_NAME_SHORT}\
- Custom: {VHDX_STORE_PATH}\ProfileContainer\{OS_NAME_SHORT}\
- Outlook search index roaming
- Default: {USER_STORE_PATH}\VHD\{OS_NAME_SHORT}\
- Custom: {VHDX_STORE_PATH}\VHD\{OS_NAME_SHORT}\
- Accelerate folder mirroring
- Default: {USER_STORE_PATH}\MirrorFolders\
- Custom: {VHDX_STORE_PATH}\MirrorFolders\
- Enable OneDrive container
- Default: {USER_STORE_PATH}\OneDrive\
- Custom: {VHDX_STORE_PATH}\OneDrive\
Profile Management now impersonates the current user to access the VHDX files and does not grant Domain Computers full control
permission to the storage path of the VHDX files.
Specify the storage path
Prepare a network storage location for the VHDX containers. Make sure that you grant your users Modify
permission or higher to the storage location.
Specify the storage path for VHDX containers by following these steps:
- Open the Group Policy Management Editor.
- Under Computer Configuration > Administrative Templates > Citrix Components > Profile Management > Advanced settings, double-click the Customize storage path for VHDX files policy.
- Select Enabled.
- In the Path to store VHDX files field, type the full path of the storage location. Example:
\\myservername\vhdx_store
. - Click Apply, and then click OK.
To enable the setting to take effect, do the following:
- Log off from all sessions that are using the user profile.
-
Run the
gpupdate /force
command from the command prompt.When the policy takes effect varies depending on the use cases:
- If it is the first time you specify a storage path for VHDX files, the policy takes effect after the user logs on.
- If it is you change the storage path for VHDX files, the policy takes effect after the user logs off for the first time.
For more information about the gpupdate
command, see the Microsoft document.
If this setting is not configured here, the value from the .ini file is used. If this setting is not configured here or in the .ini file, Profile Management stores the VHDX files in the user store.
Specify the default storage capacity for a VHD container
Each VHD container has a default storage capacity of 50 GB. To change the capacity, follow these steps:
- Open the Group Policy Management Editor.
- Under Computer Configuration > Administrative Templates > Citrix Components > Profile Management > Advanced settings, double-click the Default capacity of VHD containers (GB) policy.
- Select Enabled.
- In the Default capacity (in GB) field, type a new number as needed.
- Click OK.
Enable and configure VHD disk compaction settings
VHD disk compaction is a process that reduces the size of a VHD file by removing empty space and combining the data within the file. With the Enable VHD disk compaction policy, you can enable VHD disk compaction for Profile Management. VHD files created by Profile Management are automatically compacted on user logoff when certain conditions are met, thus saving space on central or cloud storage.
This section guides you through enabling VHD disk compaction and adjusting the default compaction settings and behavior.
Overview
VHDX disk compaction applies to the following VHDX files in Profile Management:
With the Enable VHD disk compaction policy enabled, a VHDX file is automatically compacted on user logoff when one of the following conditions is met:
-
The free space ratio of the VHD file exceeds a specified value (by default, 20%)
Free space ratio = (current VHD file size – required minimum VHD file size*) ÷ current VHD file size
* Obtained using the GetSupportedSize method of the
MSFT_Partition
class from the Microsoft Windows operating system. See Get the required minimum size for a VHD file for details. -
The number of logoffs since the last compaction reaches a specified value (by default, 5)
Note:
When a user logs off, the process of compacting VHD disks occurs in parallel with the logoff process. Thus, disk compaction does not prolong logoff time. If the VHD disk compaction process is not complete when the user attempts to log back on, Profile Management prevents the logon attempt.
Depending on your needs and the resources available, you can adjust those default settings using the following policies in Advanced settings:
- Free space ratio to trigger VHD disk compaction
- Number of logoffs to trigger VHD disk compaction
When VHD disk compaction is enabled, the VHD disk file is first defragmented using the Windows built-in defrag
tool, and then compacted. VHD disk defragmentation produces better compaction results while disabling it can save system resources. If needed, you can disable defragmentation using the following policy in Advanced settings:
- Disable defragmentation for VHD disk compaction
Enable VHD disk compaction
With VHD disk compaction enabled, you can save storage space consumed by profile container, OneDrive container, and folder mirroring container.
To enable VHD disk compaction using a GPO, follow these steps:
- Open the Group Policy Management Editor.
- Access Policies > Administrative Templates: Policy definitions (ADMX files) > Citrix Components > Profile Management > Profile Container settings.
- Double-click the VHD disk compaction policy.
- In the policy window that appears, select Enabled, and then click OK.
The configuration precedence is as follows:
- If this setting isn’t configured using a GPO, Studio, or Workspace Environment Management (WEM), the value from the .ini file is used.
- If this setting isn’t configured anywhere, the feature is disabled.
Change the compaction settings and behavior
Enabling VHD disk compaction can save storage space, but it also consumes system I/O and network bandwidth. You can monitor the system and network resource usage during the compaction process to determine whether to adjust the following settings:
- Free space ratio to trigger VHD disk compaction
- Number of logoffs to trigger VHD disk compaction
- Disable defragmentation for VHD disk compaction
To change the default compaction settings and behavior using a GPO, follow these steps:
- Open the Group Policy Management Editor.
- Access Policies > Administrative Templates: Policy definitions (ADMX files) > Citrix Components > Profile Management > Advanced settings.
- To change the free space ratio to trigger the compaction, follow these steps:
- Double-click the Free space ratio to trigger VHD disk compaction policy.
- In the policy window that appears, select Enabled, enter a percentage as needed, and then click OK.
- To change the number of logoffs (since the last compact) to trigger the compaction, follow these steps:
- Double-click the Number of logoffs to trigger VHD disk compaction policy.
- In the policy window that appears, select Enabled, enter a value as needed, and then click OK.
- To disable defragmentation for VHD disk compaction, follow these steps:
- Double-click the Disable defragmentation for VHD disk compaction policy.
- In the policy window that appears, select Enabled, and then click OK.
The configuration precedence is as follows:
- Free space ratio to trigger VHD disk compaction
- If this setting isn’t configured using a GPO, Studio, or WEM, the value from the .ini file is used.
- If this setting isn’t configured anywhere, the default value 20 (%) is used.
- Number of logoffs to trigger VHD disk compaction
- If this setting isn’t configured using a GPO, Studio, or WEM, the value from the .ini file is used.
- If this setting isn’t configured anywhere, the default value 5 is used.
- Disable defragmentation for VHD disk compaction
- If this setting isn’t configured using a GPO, Studio, or WEM, the value from the .ini file is used.
- If this setting isn’t configured anywhere, defragmentation is enabled by default.
Get the required minimum size for a VHD file
Detailed steps are as follows:
- Ensure that the VHD file is attached to the operating system.
-
Run this PowerShell command as an administrator:
Get-WmiObject -Class MSFT_Partition -Namespace ROOT\Microsoft\Windows\Storage
All partitions of your current desktop appear.
- Locate the partition corresponding to the VHD file, and then get the required minimum size (
SizeMin
) using the GetSupportedSize method.
Enable exclusive access to VHD containers
Note:
- This setting applies to OneDrive containers and the profile containers that are enabled for the entire user profile.
- If this setting is enabled for profile containers, the Enable multi-session write-back for profile containers setting is automatically disabled.
By default, VHD containers allow concurrent access. If needed, you can disable concurrent access for profile containers and OneDrive containers.
Detailed steps are as follows:
- Open the Group Policy Management Editor.
- Under Computer Configuration > Administrative Templates > Citrix Components > Profile Management > Profile container settings, double-click the Enable exclusive access to VHD containers policy.
- Select Enabled.
- Select the containers to which you want to enable exclusive access. Options include Profile container and OneDrive container.
- Click OK.
To enable the setting to take effect, do the following:
- Log off from all sessions that are using the user profile.
- Run the
gpupdate /force
command from the command prompt.
If this policy is not configured here, the value from the .ini file is used. If this policy is not configured either here or in the .ini file, the setting is disabled.
Enable automatic reattachment of VHDX disks in sessions
With the Automatically reattach VHDX disks in sessions feature, Profile Management ensures a high level of stability of VHDX-based policies.
Each VHDX-related policy relies on the relevant VHDX disk to function properly. Profile Management attaches those disks during logons and detaches them during logoffs. However, those VHDX disks might be accidentally detached during a session, preventing the policies from functioning properly. Possible causes for a VHDX disk to be detached include:
- File server encountering a transient error
- Slow network connection
With the Automatically reattach VHDX disks in sessions policy enabled, Profile Management monitors VHDX disks that are in use by the preceding VHDX-based policies. If any of the disks is detached, Profile Management reattaches the disk automatically.
Enable the policy
By default, the policy is enabled. We recommend you keep its default setting to ensure the high stability of VHDX-based policies.
If you experience performance issues with the VHDX-based policies, follow these steps to check the policy setting:
-
Open the Group Policy Management Editor.
-
Under Citrix Components > Profile Management > Advanced settings, double-click the Automatically reattach VHDX disks in sessions policy.
-
If the setting is Disabled, select Enabled, and then click OK.
For your changes to take effect, run the gpupdate /force
command from the command prompt, as documented in the Microsoft article.
Configuration precedence:
- If this policy isn’t configured here, the value from the .ini file is used, which defaults to enabled.
- If this setting is not configured either here or in the .ini file, the policy is enabled by default.