This FSLogix new feature can save Azure Storage Cost in AVD

The recent release of FSLogix 2210 (2.9.8361.52326) came out with the added ability to compact the user’s container during the sign-out phase. This is part of the VHD disk compression technology. To understand it better, let’s first understand what VHD disk compaction is.

Picture Credit: Pexels.com

What is VHD Disk Compaction?

Every time a user logs out, a process known as VHD disk compaction begins. Its goal is to automatically reduce the amount of storage a user’s container needs based on a set threshold. During the sign-out process, FSLogix will look at the disk to decide if it needs to be compacted or not. By default, VHD Disk compression is enabled. To turn it off, you need to go to Disable VHD Disk Compaction. The Optimize Drives service is necessary for the compaction process (defragsvc). By using the SizeMin parameter from the GetSupportedSize function to query the MSFT_Partition API, this service may find the smallest supported size. Immovable files, or those that cannot be moved, are considered in this.

Let’s understand the algorithm when the VHD Compaction Service will run.

Each time a user logs out, FSLogix will decide whether to carry out the compaction operation. VHD Disk Compaction will run if the following conditions are satisfied:

The container’s size must exceed 1 GB (size on disk).

The difference (C) between the minimal size requested(A) and the used size on disk(B). This has to be more than or equal to 20% of the container’s used volume (A).

This can be computed using the formula:

A – B = C

Compaction will take place if C ≥ (A x 0.2).

Compaction won’t take place if C < (A x 0.2).

Example Scenario:

  • Example 1: The consumed size of a container is 6GB. When we call GetSupportedSize, the resulting minimum size is 2.5GB:
    • 6 – 2.5 = 3.5 GB
    • 20% of 6 GB = 1.2 GB
    • 3.5 GB is greater than 1.2 GB, so compaction will run.
  • Example 2: The consumed size of a container is 12GB. When we call GetSupportedSize, the resulting minimum size is 10GB:
    • 12 – 10 = 2 GB
    • 20% of 12 GB = 2.4 GB
    • 2 GB is less than 2.4 GB, so compaction won’t run.\

End User Experience

Users will see the message after the compaction is complete: “Waiting for FSLogix Apps Services for some time.” The compaction procedure ought to take, on average, 20 to 30 seconds, depending on the amount of space to be recovered. The first compact operation, which is based on recoverable space and other computing resource parameters, will take the longest.

Every subsequent sign-out should be quicker, as there should be less data to compress. The maximum time that VHD Disk Compaction can run is five minutes. The procedure will cease and the sign-out will resume if this maximum is achieved. The operation will pick up where it left off during the subsequent sign-out.

Winlogn Process

VHD Disk Compaction runs as part of the Winlogon procedure upon user sign-out. Every time a process causes the sign-out time to go beyond 60 seconds, the Winlogon process will generate a warning event. These alerts are normal and expected, since the compaction process may take longer than 60 seconds, depending on the size of the VHD(x) and the amount of space that needs to be recovered. The Winlogon threshold has an unalterable preset value.

That’s all for today. I will come out with my FSLogix disk compression calculator very soon.

0.00 avg. rating (0% score) - 0 votes