Edit

Share via


Format-Volume

Formats one or more existing volumes or a new volume on an existing partition.

Syntax

ByDriveLetter (Default)

Format-Volume
    [-DriveLetter] <Char[]>
    [-FileSystem <String>]
    [-NewFileSystemLabel <String>]
    [-AllocationUnitSize <UInt32>]
    [-Full]
    [-Force]
    [-Compress]
    [-ShortFileNameSupport <Boolean>]
    [-SetIntegrityStreams <Boolean>]
    [-UseLargeFRS]
    [-DisableHeatGathering]
    [-IsDAX <Boolean>]
    [-DevDrive]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ById

Format-Volume
    -ObjectId <String[]>
    [-FileSystem <String>]
    [-NewFileSystemLabel <String>]
    [-AllocationUnitSize <UInt32>]
    [-Full]
    [-Force]
    [-Compress]
    [-ShortFileNameSupport <Boolean>]
    [-SetIntegrityStreams <Boolean>]
    [-UseLargeFRS]
    [-DisableHeatGathering]
    [-IsDAX <Boolean>]
    [-DevDrive]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByPaths

Format-Volume
    -Path <String[]>
    [-FileSystem <String>]
    [-NewFileSystemLabel <String>]
    [-AllocationUnitSize <UInt32>]
    [-Full]
    [-Force]
    [-Compress]
    [-ShortFileNameSupport <Boolean>]
    [-SetIntegrityStreams <Boolean>]
    [-UseLargeFRS]
    [-DisableHeatGathering]
    [-IsDAX <Boolean>]
    [-DevDrive]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByLabel

Format-Volume
    -FileSystemLabel <String[]>
    [-FileSystem <String>]
    [-NewFileSystemLabel <String>]
    [-AllocationUnitSize <UInt32>]
    [-Full]
    [-Force]
    [-Compress]
    [-ShortFileNameSupport <Boolean>]
    [-SetIntegrityStreams <Boolean>]
    [-UseLargeFRS]
    [-DisableHeatGathering]
    [-IsDAX <Boolean>]
    [-DevDrive]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByPartition

Format-Volume
    [-Partition <CimInstance>]
    [-FileSystem <String>]
    [-NewFileSystemLabel <String>]
    [-AllocationUnitSize <UInt32>]
    [-Full]
    [-Force]
    [-Compress]
    [-ShortFileNameSupport <Boolean>]
    [-SetIntegrityStreams <Boolean>]
    [-UseLargeFRS]
    [-DisableHeatGathering]
    [-IsDAX <Boolean>]
    [-DevDrive]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObject (cdxml)

Format-Volume
    -InputObject <CimInstance[]>
    [-FileSystem <String>]
    [-NewFileSystemLabel <String>]
    [-AllocationUnitSize <UInt32>]
    [-Full]
    [-Force]
    [-Compress]
    [-ShortFileNameSupport <Boolean>]
    [-SetIntegrityStreams <Boolean>]
    [-UseLargeFRS]
    [-DisableHeatGathering]
    [-IsDAX <Boolean>]
    [-DevDrive]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Format-Volume cmdlet formats one or more existing volumes, or a new volume on an existing partition. This cmdlet returns the object representing the volume that was just formatted, with all properties updated to reflect the format operation.

To create a new volume, use this cmdlet in conjunction with the Initialize-Disk and New-Partition cmdlets.

Examples

Example 1: Quick format

PS C:\>Format-Volume -DriveLetter D

This example performs a format of the D volume.

Example 2: Full format using FAT32

PS C:\>Format-Volume -DriveLetter D -FileSystem FAT32 -Full -Force

This example performs a full format of the D volume using the FAT32 file system.

Example 3: Format all D drives across a cluster

PS C:\> Get-Volume -DriveLetter D

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining      Size
----------- --------------- ---------- --------- ------------ ----------------- -------------      ----
D           Server1         NTFS       Fixed     Healthy      OK                    126.76 GB 126.87 GB
D           Server2         NTFS       Fixed     Healthy      OK                    126.76 GB 126.87 GB


PS C:\> Format-Volume -DriveLetter D

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining      Size
----------- --------------- ---------- --------- ------------ ----------------- -------------      ----
D                           NTFS       Fixed     Healthy      OK                    126.76 GB 126.87 GB
D                           NTFS       Fixed     Healthy      OK                    126.76 GB 126.87 GB

Be careful, if using this cmdlet on a Windows Cluster, it would format all drives returned by the Get-Volume cmdlet.

Example 4: Full format using NTFS and allocation size 8192

PS C:\> Format-Volume -DriveLetter D -FileSystem NTFS -AllocationUnitSize 8192

This example performs a full format of the D volume using the NTFS file system and allocation size 8192.

Parameters

-AllocationUnitSize

Specifies the allocation unit size to use when formatting the volume.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ClusterSize

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

-Compress

Enables compression on all files and folders created on the specified NTFS 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

-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

-DevDrive

Formats the volume as a dev drive. A dev drive is optimized for performance of developer scenarios and gives administators control over what minifilters are attached to the volume.

Parameter properties

Type:SwitchParameter
Default value:False
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

-DisableHeatGathering

Indicates that the cmdlet does not gather file activity on the specified tiered volume. You can override file placement based on the desired storage tier. This parameter is only valid for tiered volumes.

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 format.

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

-FileSystem

Specifies the file system with which to format the volume. The acceptable values for this parameter are:NTFS, ReFS, exFAT, FAT32, and FAT.

Parameter properties

Type:String
Default value:None
Accepted values:FAT, FAT32, exFAT, NTFS, ReFS
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

-FileSystemLabel

Specifies the label to use for the volume.

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

-Force

Specifies the override switch.

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

-Full

Performs a full format. A full format writes to every sector of the disk, takes much longer to perform than the default (quick) format, and is not recommended on storage that is thinly provisioned.

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

-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

-IsDAX

Formats a volume as a DirectAccess (DAX) volume.

DAX provides applications with direct access and byte-addressability options via memory mapping on storage class memory (SCM) devices, such as NVDIMM-N.

If you do not specify the IsDAX parameter, the cmdlet defaults to a regular, non-DAX volume.

Parameter properties

Type:Boolean
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

-NewFileSystemLabel

Specifies a new label to use for the volume.

Parameter properties

Type:String
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 format.

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

-Partition

Specifies the partition object on which to create the new volume. Enter a Partition CIM object, which is exposed by the Get-Partition and New-Partition cmdlets.

Parameter properties

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

Parameter sets

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

-Path

Specifies the path of the volume to format.

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

-SetIntegrityStreams

Enables integrity streams on the volume to be formatted.

Parameter properties

Type:Boolean
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

-ShortFileNameSupport

Specifies that support for short file names should be enabled on this volume.

Parameter properties

Type:Boolean
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

-UseLargeFRS

Specifies that large File Record Segment (FRS) should be used.

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.

NOTE: The WhatIf switch does not work with this cmdlet.

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 an MSFT_Volume object to the InputObject parameter.

CimInstance

You can use the pipeline operator to pass an MSFT_Partition object to the Partition parameter.

Outputs

CimInstance

This cmdlet returns an object that represents the newly formatted volume.

Notes

  • Be careful, if using this cmdlet on a Windows Cluster, it would format all drives returned by the Get-Volume cmdlet.