Format

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Format

Formats the disk in the specified volume to accept Windows files.

Syntax

format Volume [/fs:FileSystem] [/v:Label] [/q] [/a:UnitSize] [/c] [/x]

format Volume [/v:Label] [/q] [**/f:**Size]

format Volume [/v:Label] [/q] [**/t:Tracks/n:**Sectors]

format Volume [/v:Label] [/q]

format Volume [/q]

Parameters
  • Volume
    Specifies the mount point, volume name, or drive letter (followed by a colon), of the drive you want to format. If you do not specify any of the following command-line options, format uses the volume type to determine the default format for the disk.
  • /fs: FileSystem
    Specifies the file system to use file allocation table (FAT), FAT32, or NTFS. Floppy disks can use only the FAT file system.
  • /v: Label
    Specifies the volume label. If you omit the /v command-line option or use it without specifying a volume label, format prompts you for the volume label after the formatting is completed. Use the syntax /v: to prevent the prompt for a volume label. If you format more than one disk by using one format command, all of the disks will be given the same volume label. For more information about disk volume labels, see Related Topics.
  • /a: UnitSize
    Specifies the allocation unit size to use on FAT, FAT32, or NTFS volumes. If you do not specify UnitSize, it is chosen based on volume size. The following table lists valid values for UnitSize.
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="header">
<th>Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p><strong>512</strong></p></td>
<td><p>Creates 512 bytes per cluster.</p></td>
</tr>
<tr class="even">
<td><p><strong>1024</strong></p></td>
<td><p>Creates 1024 bytes per cluster.</p></td>
</tr>
<tr class="odd">
<td><p><strong>2048</strong></p></td>
<td><p>Creates 2048 bytes per cluster.</p></td>
</tr>
<tr class="even">
<td><p><strong>4096</strong></p></td>
<td><p>Creates 4096 bytes per cluster.</p></td>
</tr>
<tr class="odd">
<td><p><strong>8192</strong></p></td>
<td><p>Creates 8192 bytes per cluster.</p></td>
</tr>
<tr class="even">
<td><p><strong>16K</strong></p></td>
<td><p>Creates 16 kilobytes per cluster.</p></td>
</tr>
<tr class="odd">
<td><p><strong>32K</strong></p></td>
<td><p>Creates 32 kilobytes per cluster.</p></td>
</tr>
<tr class="even">
<td><p><strong>64K</strong></p></td>
<td><p>Creates 64 kilobytes per cluster.</p></td>
</tr>
</tbody>
</table>
  • /q
    Performs a quick format. 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. You should use the /q command-line option to format only previously formatted volumes that you know are in good condition.
  • /f: Size
    Specifies the size of the floppy disk to format. When possible, use this command-line option instead of the /t and /n command-line options. Windows accepts the following value for size:
**1440** or **1440k** or **1440kb** or **1.44** or **1.44m** or **1.44mb**

1.44-MB, double-sided, quadruple-density, 3.5-inch disk
  • /t: Tracks
    Specifies the number of tracks on the disk. When possible, use the /f command-line option instead of this command-line option. If you use the /t command-line option, you must also use the /n command-line option. These two command-line options provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f command-line option with the /t command-line option.
  • /n: Sectors
    Specifies the number of sectors per track. When possible, use the /f command-line option instead of this command-line option. If you use the /n command-line option, you must also use the /t command-line option. These two command-line options provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f command-line option with the /n command-line option.
  • /c
    NTFS only. Files created on the new volume will be compressed by default.
  • /x
    Causes the volume to dismount, if necessary, before it is formatted. Any open handles to the volume will no longer be valid.
  • /?
    Displays help at the command prompt.
Remarks
  • Using format at the Recovery Console

    The format command, with different parameters, is available from the Recovery Console.

  • Administrative credentials

    You must be a member of the Administrators group to format a hard drive.

  • Using format

    The format command creates a new root directory and file system for the disk. It can also check for bad areas on the disk, and it can delete all data on the disk. To be able to use a new disk, you must first use this command to format the disk.

  • Typing a volume label

    After formatting a floppy disk, format displays the following message:

    Volume label (11 characters, ENTER for none)?

    The volume label can be a maximum of 11 characters (including spaces). If you do not want your disk to have a volume label, just press ENTER. For information about volume labels, see Related Topics.

  • Formatting a hard disk

    When you use the format command to format a hard disk, format displays a message of the following form before attempting to format the hard disk:

    WARNING, ALL DATA ON NON-REMOVABLE DISK 
    DRIVE x: WILL BE LOST! 
    Proceed with Format (Y/N)? _ 
    

    To format the hard disk, press Y; if you do not want to format the disk, press N. You must have Administrator rights to format a hard disk.

  • Unit size

    FAT file systems restrict the number of clusters to no more than 65526. FAT32 file systems restrict the number of clusters to between 65527 and 4177917.

    NTFS compression is not supported for allocation unit sizes above 4096.

  • Format messages

    When formatting is complete, format displays messages showing the total disk space, any space marked as defective, and the space available for your files.

  • Quick formatting

    You can speed up the formatting process by using the /q command-line option. Use this command-line option only if there are no bad sectors on your hard disk.

  • Using format with a reassigned drive or a network drive

    You should not use the format command on a drive prepared by using the subst command. You cannot format disks over a network.

  • Format exit codes

    The following table lists each exit code and a brief description of its meaning.

    Exit code Description

    0

    The format operation was successful.

    1

    Incorrect parameters were supplied.

    4

    A fatal error occurred (any error other than 0, 1, or 5).

    5

    The user pressed N in response to the prompt "Proceed with Format (Y/N)?" to stop the process.

    You can check these exit codes by using the errorlevel condition with the if batch command.

Examples

To format a new floppy disk in drive A using the default size, type:

format a:

To perform a quick format operation on a previously formatted disk in drive A, type:

format a: /q

To format a floppy disk in drive A and assign it the volume label "DATA," type:

format a: /v:DATA

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command shell overview
Dir
If
Label
Vol
Subst
Command-line reference A-Z