FORMAT.com

Format a disk for use with Windows.

Syntax
      FORMAT volume [/FS:file-system] [/V:label] [/Q] [/L] [/A:size] [/C] [/I:state] [ /X] [/P:passes] [/S:state]
      FORMAT volume [/V:label] [/Q] [/F:size] [/P:passes]
      FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes]
      FORMAT volume [/V:label] [/Q] [/P:passes]
      FORMAT volume [/Q]

Key
   volume          The drive letter (followed by a colon), mount point, or volume name.
                   that you want to format. If you don’t specify any of the following command-line
                   options, format uses the volume type to determine the default format for the disk.

   /FS:file-system The type of file system (FAT, FAT32, exFAT, NTFS, UDF, ReFS).
/A:size Override the default allocation unit size. Also known as Cluster size. Default settings are strongly recommended for general use. See below for allocation unit sizes. NTFS compression is not supported for allocation unit sizes above 4096. /C Compression, files added to the new disk will be compressed by default (NTFS only). /D UDF 2.50 only: Metadata will be duplicated. /DAX[:state] NTFS Only: Enable direct access storage (DAX) mode for this volume. In DAX mode, the volume is accessed via the memory bus, boosting IO performance. A volume can be formatted with DAX mode only if the hardware is DAX capable. State can specify "enable" or "disable". * Windows 10+ /DAX is considered as /DAX:enable. /F:size The size of the floppy disk to format (720, 1.2, 1.44, 2.88, or 20.8). /I:state ReFS only: enable integrity on the new volume. "state" is either "enable" or "disable" Integrity is enabled on storage that supports data redundancy by default. /L NTFS Only: Use large file record segments (FRS). By default, the volume will be formatted with small size file records. Use this to host very large files, such as VDHX files larger than 1 TB. This increases the number of extents allowed per file on the volume. /LogSize[:size] NTFS Only: The size for NTFS log file in kilobytes. The minimum supported size is 2MB, so specifying size smaller than 2MB will result in a 2MB log file. Zero indicates the default value which generally depend on the volume size. * Windows 10+ /N:sectors The number of sectors per track. /NoRepairLogs NTFS Only: Disable NTFS repair logs. * Windows 10+ If the flag is set spotfix (i.e. chkdsk /spotfix) will not work. /P:count Zero every sector on the volume. After that, the volume will be overwritten "count" times using a different random number each time. If "count" is zero, no additional overwrites are made after zeroing every sector. This switchis ignored when /Q is specified. /Q Perform a quick format. This switch overrides /P (zero out bytes). Deletes the file table and the root directory of a previously formatted volume, but does not perform a sector-by-sector scan for bad areas. Use the /Q option to format only previously formatted volumes that are known to be in good condition. /R:revision UDF only: Force the format to a specific UDF version (1.02, 1.50, 2.00, 2.01, 2.50). default= 2.01 /S:state Support for short filenames (enable, disable) Short names are disabled by default /T:tracks The number of tracks per disk side. /V:label The volume label. If you omit this option, format will prompt for a volume label after the formatting is complete. Use the syntax /V: to prevent the prompt. If you use a single format command to format more than one disk, all of the disks are given the same volume label. /X Force the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.

The Allocation Unit or Cluster Size is a term of the OS file system software, the Sector Size is a term of the underlying hardware.

File System Allocation Unit / Cluster sizes Volume size limit Restrictions on the number of clusters
(per volume)
ReFS 4K or 64K for large, sequential IO workloads. 35P in theory.
256T in practice, this may change.
 
NTFS

512, 1024, 2048, 4096, 8192, 16K, 32K, 64K

Default = 4096, above 16T NTFS will assign 8K clusters.

8P with a 2048K Cluster size.
(256T in early versions).
16T with a default 4K Cluster size.

Max = 232 - 1
(Roughly 4 billion) [x]

 

exFAT 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
128K, 256K, 512K, 1M, 2M, 4M, 8M, 16M, 32M.

128P, 512T recommended

For SDXC/MicroSDXC drives:
Min 64G

For Compact Flashdrives:
Max 256G

Max = 232 - 11 [x]
FAT32 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
(128K, 256K for sector size > 512 bytes).

2T
or 16T if the drive has 1k sectors.

Maximum file size: 4G

For USB Flash drives the limit is:
Min 2G, Max 32G

For SDHC/MicroSDHC drives:
Min 4G, Max 32G

Min = 65,526
Max = 4,177,918
FAT 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
(128K, 256K for sector size > 512 bytes).
4G Max = 65,526

The allocation unit size (also known as cluster size), determines the smallest chunk of disk space that will be used to store one file.
For disks holding a small number of large files use a large cluster size.
For disks holding a large number of small files, use a small cluster size. If the small cluster size limits the volume size, add more volumes.

Examples

Format drive D: as NTFS:

@Echo off
Echo Warning this will reformat the entire D: disk! press Ctrl-C to abort.
PAUSE
format D: /FS:NTFS /x /V:Data

"The disks had a recording density of 1,100 bits per inch, and could move data out of the drive at 77 kilobytes per second” ~ Early hard drive specs.

Related commands

CONVERT - Convert a FAT drive to NTFS.
DISKPART - Disk Administration.
SYSPREP - (Generalize) a Windows installation.
Q140365 - Default cluster size for NTFS, FAT, and exFAT.
Q17423 - How to create a Bootdisk.
PowerShell equivalent: Format-Volume
Get-CimInstance -ClassName Win32_Volume | Select-Object -Property Name, Label, BlockSize
Equivalent bash command (Linux): mkfs, in FreeBSD & OSX: newfs, fsck_exfat


 
Copyright © 1999-2024 SS64.com
Some rights reserved