Forum Discussion
FS Logix Compaction
It is cutoff in 2023.
FSLogix doesn’t natively support automatic compaction of differencing disks, such as VHD(x) files. However, you can manage compaction manually or through scheduled tasks to reduce the size of these disks.
If FSLogix doesn’t automatically support compaction on differencing disks, you can use the following approach to manage disk size:
Log Off the User Session:
Ensure the user session is logged off, as VHD(x) files must be detached to perform compaction.
Use PowerShell for Compacting VHD(x) Files:
Use the Optimize-VHD PowerShell cmdlet, which is part of the Hyper-V module, to compact the disks. This cmdlet works with both VHD and VHDX formats.
Run the following command on the VHD file:
Optimize-VHD -Path "Path\To\Your\VHDfile.vhdx" -Mode Full
In above command Mode Full will compact the VHD(x) file to the minimum possible size.
you can create a scheduled task to run a PowerShell script that compacts VHD files during off-hours or maintenance windows.
see below as an Example:
$VHDPath = "C:\Path\To\VHDs\*.vhdx"
Get-ChildItem -Path $VHDPath | ForEach-Object {
Optimize-VHD -Path $_.FullName -Mode Full
}
Configure Group Policies to help manage profile size and redirections to keep VHD files more efficient, reducing the need for compaction.
FSLogix has utilities for profile cleanup, but they don’t inherently compact disks. These tools can, however, reduce unnecessary data within profiles, which indirectly keeps the VHDs smaller.
Some third-party tools are available for managing VHD compaction in FSLogix environments, though always ensure compatibility with your setup