편집

다음을 통해 공유


Optimize-Volume

Optimizes a volume.

Syntax

ByDriveLetter (Default)

Optimize-Volume
    [-DriveLetter] <Char[]>
    [-ReTrim]
    [-Analyze]
    [-Defrag]
    [-SlabConsolidate]
    [-TierOptimize]
    [-NormalPriority]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ById

Optimize-Volume
    -ObjectId <String[]>
    [-ReTrim]
    [-Analyze]
    [-Defrag]
    [-SlabConsolidate]
    [-TierOptimize]
    [-NormalPriority]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByPaths

Optimize-Volume
    -Path <String[]>
    [-ReTrim]
    [-Analyze]
    [-Defrag]
    [-SlabConsolidate]
    [-TierOptimize]
    [-NormalPriority]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByLabel

Optimize-Volume
    -FileSystemLabel <String[]>
    [-ReTrim]
    [-Analyze]
    [-Defrag]
    [-SlabConsolidate]
    [-TierOptimize]
    [-NormalPriority]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObject (cdxml)

Optimize-Volume
    -InputObject <CimInstance[]>
    [-ReTrim]
    [-Analyze]
    [-Defrag]
    [-SlabConsolidate]
    [-TierOptimize]
    [-NormalPriority]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

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.

Examples

Example 1: Perform TRIM optimization

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.

Example 2: Analyze a volume

PS C:\>Optimize-Volume -DriveLetter H -Analyze -Verbose

This example reports only the current optimization state of drive H.

Example 3: Defragment a volume

PS C:\>Optimize-Volume -DriveLetter H -Defrag -Verbose

This example defragments drive H.

Example 4: Perform slab consolidation

PS C:\>Optimize-Volume -DriveLetter H -SlabConsolidate -Verbose

This example performs slab consolidation on the storage space backing volume H.

Example 5: Tier optimize a volume

PS C:\>Optimize-Volume -DriveLetter H -TierOptimize

This example performs tier optimization on the tiered storage space backing volume H.

Parameters

-Analyze

Analyzes the volume specified for fragmentation statistics. Performs analysis only and reports the current optimization state of the volume.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CimSession

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.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Session

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Defrag

Indicates that the cmdlet initiates defragmentation on the specified volume. Defragmentation consolidates fragmented regions of files to improve performance of sequential reads or writes.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DriveLetter

Specifies the drive letter of the volume to optimize.

Parameter properties

Type:

Char[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByDriveLetter
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FileSystemLabel

Specifies the file system label of the volume to optimize.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByLabel
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-InputObject

Specifies the input object that is used in a pipeline command.

Parameter properties

Type:

CimInstance[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject (cdxml)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-NormalPriority

Indicates that this cmdlet the operation at normal priority. By default, the priority is low.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ObjectId

Specifies the ID of the volume to optimize.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Id

Parameter sets

ById
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Path

Specifies the path of the volume to optimize.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByPaths
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ReTrim

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SlabConsolidate

Indicates that the cmdlet performs slab consolidation on the storage to optimize slab allocations and to reduce the number of used slabs.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ThrottleLimit

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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TierOptimize

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

CimInstance

You can use the pipeline operator to pass a Volume object to the InputObject parameter.

Outputs

None

By default, this cmdlet doesn't return any output.

Notes

  • When used in Failover Cluster, cmdlets from the Storage module operate on cluster level (all servers in the cluster).