UtilDrivesFormatDrive Method

Formats a drive.

Definition

Namespace: DevCase.Core.IO.Devices.Drives
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static DriveFormatResult FormatDrive(
	char driveLetter,
	bool quickFormat,
	DriveFileSystem fileSystem = DriveFileSystem.NTFS,
	int clusterSize = 0,
	string volumeLabel = "",
	bool enableCompression = false
)

Parameters

driveLetter  Char
The drive letter to format.
quickFormat  Boolean
If set to , formats the volume with a quick format by removing files from the disk without scanning the disk for bad sectors.

Use this option only if the disk has been previously formatted, and you know that the disk is not damaged.

The default value is .

fileSystem  DriveFileSystem  (Optional)
The filesystem format to use for this volume.

Default value is NTFS.

clusterSize  Int32  (Optional)
The disk allocation unit size—cluster size.

All of the filesystems organizes the hard disk based on cluster size, which represents the smallest amount of disk space that can be allocated to hold a file.

The smaller the cluster size you use, the more efficiently your disk stores information.

If no cluster size is specified during format, Windows picks defaults based on the size of the volume. These defaults have been selected to reduce the amount of space lost and to reduce fragmentation.

For general use, the default settings are strongly recommended.

volumeLabel  String  (Optional)
The label to use for the new volume.

The volume label can contain up to 11 characters for FAT16 and FAT32 volumes, and up to 32 characters for NTFS filesystem volumes.

enableCompression  Boolean  (Optional)
Not implemented.

Return Value

DriveFormatResult
If format success, the return value is Success; otherwise; a DriveFormatResult value indicating the error.

Remarks

Example

This is a code example.
C#
No code example is currently available or this language may not be supported.

Exceptions

ArgumentException Volume-label for X filesystem can't be larger than Y characters.;volumeLabel

See Also