description | external help file | Module Name | ms.date | online version | schema | title |
---|---|---|---|---|---|---|
Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell. |
Volume.cdxml-help.xml |
Storage |
12/20/2016 |
2.0.0 |
Optimize-Volume |
Optimizes a volume.
Optimize-Volume [-DriveLetter] <Char[]> [-ReTrim] [-Analyze] [-Defrag] [-SlabConsolidate] [-TierOptimize]
[-NormalPriority] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Optimize-Volume -ObjectId <String[]> [-ReTrim] [-Analyze] [-Defrag] [-SlabConsolidate] [-TierOptimize]
[-NormalPriority] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Optimize-Volume -Path <String[]> [-ReTrim] [-Analyze] [-Defrag] [-SlabConsolidate] [-TierOptimize]
[-NormalPriority] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Optimize-Volume -FileSystemLabel <String[]> [-ReTrim] [-Analyze] [-Defrag] [-SlabConsolidate] [-TierOptimize]
[-NormalPriority] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Optimize-Volume -InputObject <CimInstance[]> [-ReTrim] [-Analyze] [-Defrag] [-SlabConsolidate] [-TierOptimize]
[-NormalPriority] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
The Optimize-Volume cmdlet optimizes a volume, performing defragmentation, trim, slab consolidation, and storage tier processing. If no parameter is specified, then the default operation will be performed per the drive type as follows.
- HDD, Fixed VHD, Storage Space. -Analyze -Defrag.
- Tiered Storage Space. -TierOptimize.
- SSD with TRIM support. -Retrim.
- Storage Space (Thinly provisioned), SAN Virtual Disk (Thinly provisioned), Dynamic VHD, Differencing VHD. -Analyze -SlabConsolidate -Retrim.
- SSD without TRIM support, Removable FAT, Unknown. No operation.
PS C:\>Optimize-Volume -DriveLetter H -ReTrim -Verbose
This example optimizes drive H by re-sending Trim requests. This is useful on SSD media, and thinly provisioned storage.
PS C:\>Optimize-Volume -DriveLetter H -Analyze -Verbose
This example reports only the current optimization state of drive H.
PS C:\>Optimize-Volume -DriveLetter H -Defrag -Verbose
This example defragments drive H.
PS C:\>Optimize-Volume -DriveLetter H -SlabConsolidate -Verbose
This example performs slab consolidation on the storage space backing volume H.
PS C:\>Optimize-Volume -DriveLetter H -TierOptimize
This example performs tier optimization on the tiered storage space backing volume H.
Analyzes the volume specified for fragmentation statistics. Performs analysis only and reports the current optimization state of the volume.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
Type: CimSession[]
Parameter Sets: (All)
Aliases: Session
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Indicates that the cmdlet initiates defragmentation on the specified volume. Defragmentation consolidates fragmented regions of files to improve performance of sequential reads or writes.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the drive letter of the volume to optimize.
Type: Char[]
Parameter Sets: ByDriveLetter
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the file system label of the volume to optimize.
Type: String[]
Parameter Sets: ByLabel
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the input object that is used in a pipeline command.
Type: CimInstance[]
Parameter Sets: InputObject (cdxml)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Indicates that this cmdlet the operation at normal priority. By default, the priority is low.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the ID of the volume to optimize.
Type: String[]
Parameter Sets: ById
Aliases: Id
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the path of the volume to optimize.
Type: String[]
Parameter Sets: ByPaths
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Generates TRIM and Unmap hints for all currently unused sectors of the volume, notifying the underlying storage that the sectors are no longer needed and can be purged. This can recover unused capacity on thinly provisioned drives.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates that the cmdlet performs slab consolidation on the storage to optimize slab allocations and to reduce the number of used slabs.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
If this parameter is omitted or a value of 0
is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates that the cmdlet performs tier optimization of the volume, which places file data on the optimal storage tier according to heat or desired placement. This parameter only applies to tiered spaces volumes with more than one storage tier.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can use the pipeline operator to pass a Volume object to the InputObject parameter.
This cmdlet does not generate output.
- When used in Failover Cluster, cmdlets from the Storage module operate on cluster level (all servers in the cluster).