Optimize Volume - PowerShell


Optimize-Volume is a PowerShell command that optimizes the performance of storage volumes by defragmenting and recompressing the data stored on them. It primarily targets volumes formatted with the Resilient File System (ReFS) file system, improving read and write performance and enhancing data integrity.


Optimize-Volume [-DriveLetter] <String> [-FileSystem] <String[]> [-Verbose] [-WhatIf] [-Confirm]


  • -DriveLetter: Specifies the drive letter of the volume to optimize.
  • -FileSystem: Specifies an array of file system names to optimize. The default value is “*” (all ReFS volumes).
  • -Verbose: Enables verbose output, providing detailed progress information.
  • -WhatIf: Simulates the command without actually performing the optimization.
  • -Confirm: Prompts for confirmation before performing the optimization.


Optimize a Specific Volume

Optimize-Volume -DriveLetter C:

Optimize All ReFS Volumes

Optimize-Volume -FileSystem ReFS

Optimize a Volume with Verbose Output

Optimize-Volume -DriveLetter D: -Verbose

Common Issues

  • Insufficient Disk Space: The optimization process requires temporary disk space. Ensure there is sufficient free space on the volume being optimized.
  • Volume in Use: If the volume is in use by applications or services, the optimization may be interrupted. Close all applications and services before optimizing.
  • Data Corruption: If the volume contains corrupted data, the optimization process may fail. Run chkdsk or other data recovery tools to repair any corruption before optimizing.


Optimize-Volume can be combined with other PowerShell commands, such as:

  • Get-Volume: Retrieves information about volumes, allowing you to identify ReFS volumes for optimization.
  • Measure-Object: Measures the performance of the volume before and after optimization, providing quantitative insights into its effectiveness.