Troubleshooting VHD Disk Compaction

Important

The VHD Disk Compaction feature is available in FSLogix 2210 (2.9.8361.52326) or later.

Use this article to troubleshoot issues you're having with the VHD Disk Compaction feature.

Unexpected VHD disk compaction results

  • Affected version(s): 2210 (2.9.8361.52326) and later (ongoing)

Using ProfileType = 3 or VHDAccessMode = 1,2, or 3, creates differencing disks. This affects the VHD disk compaction process because the size of the differencing disk is used to evaluate the thresholds. Most often these differencing disks are small and never meet the thresholds.

Resolution

We plan to address this issue in a future release.

ERROR:00000422 The defragsvc is disabled OR ERROR:00000102 Failed to query minimum supported size

The VHD Disk Compaction feature relies on the Optimize Drives (defragsvc) and Microsoft Storage Spaces SMP (smphost) services. If the service StartupType is set to Disabled, VHD Disk Compaction can't run. The service StartupType must be set to Manual or Automatic, regardless if the service state is Running or Stopped.

Resolution: Configure service start-up behavior

Use one of these methods for configuring the service startup behavior.

Services tool

  1. Select Start, point to Administrative Tools, and then select Services.
  2. Right-click Optimize Drives service, and then select Properties.
  3. From the General tab, select the drop-down next to Startup Type, and then select Manual or Automatic.
  4. Right-click Microsoft Storage Spaces SMP service, and then select Properties.
  5. From the General tab, select the drop-down next to Startup Type, and then select Manual or Automatic.
  6. Select OK, and then close the Services tool.

PowerShell

  1. Open PowerShell as an Administrator.

  2. Run the following command:

    Set-Service defragsvc -StartupType Manual
    Set-Service smphost -StartupType Manual
    

Data collection

The VHD Disk Compaction feature provides information through log files and event logs.

Log files

The path for the log files is C:\ProgramData\FSLogix\Logs\Profile\Profile-yyyyMMdd.log. During the sign out phase, the log file has entries toward the end of the sign out process for the disk compaction events.

Tip

When reviewing FSLogix logs, press Ctrl+F to search the file, and then type [ERROR:. This will find any errors including those related to VHD Disk Compaction.

Sample log file entries:

  • WasCompacted: true

    [14:46:46.854][tid:00001084.0000105c][INFO] Disk size results: WasCompacted: true, MaxSupportedSize: 31456214528, MinSupportedSize: 1643998720, SizeOnDisk (Before: 3704442880 - After: 1855410176), Space Saved: 1849032704, Compaction took: 24687

  • WasCompacted: false

    [18:35:31.300][tid:00000ec4.00000d3c][INFO] Disk size results: WasCompacted: false, MaxSupportedSize: 15727574528, MinSupportedSize: 2194816512, SizeOnDisk (Before: 1816133632 - After: 1816133632), Space Saved: 0, Compaction took: 1547 [18:35:31.300][tid:00000ec4.00000d3c][INFO] Disk was not compacted, Reason: Not enough recoverable space for compaction.

Event Logs

The table lists the events that can be logged for VHD Disk Compaction:

Log name: Microsoft-FSLogix-Apps

Log Event ID Message
Operational 57 Disk was compacted: <true-or-false>. Sign out time increased by xx milliseconds. Disk size reduced by xx MB. (VHDPath: <path-to-vhd>)
Operational 58 Volume optimization failed, Path: <path>, Message: <message>, ExtendedMessage <extended-message>
Admin 60 The VHDCompactDisk configuration setting is dependent on the defragsvc service. The service start type is set to disabled. Make sure the service start type is set to Manual or Automatic.
Operational 61 This vhd(x) can't be compacted because it has a fixed size. VHD(x) Path: <path-to-vhd>
Admin 62 Unable to compact the disk, Message: <message>, Path: <path>, ExtendedMessage: <extended-message>
Admin 63 Failed during disk compaction, ErrorCode: <error code>, VHD(x) Path: <path>

Next steps