Formatting a Disk with the Format Utility
The Format utility formats a drive and prepares it for use. The utility removes any existing data from the volume you select. This section discusses the command line version of the Format utility.
The recovery console offers a slightly different version of this utility. You must be a member of the Administrators group to use this utility. The utility always displays a warning message before it formats a hard drive; you must specifically accept the warning message content before the format will start. This utility uses the following syntax:
FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X] [/P:Passes] 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]
The following list describes each of the command line arguments.
WARNING: The Format utility has caused people more woe than any other utility ever created. Simply stated, the Format utility will format your hard drive. In many cases, you can recover files that the Format utility removes from the hard drive using a special utility, but the process is time consuming and error prone at best. Use this utility with extreme caution.
volume Specifies the drive letter, mount point, or volume name to format. Always include this argument because the default value is the current drive.
/FS:filesystem Specifies the file system to use to format the volume. You have the option of using the FAT (older 16-bit), FAT32, or NTFS file systems when working with a hard drive. Floppy media only accepts the FAT file system.
/V:[label] Specifies the volume name. If you use this command line switch without specifying a volume name, the Format utility prompts you for a volume name on completion of the format.
/Q Performs a quick format of the media. A quick format deletes the file table and the root directory of the media. It doesn't perform a sector-by-sector scan of the media to locate bad sectors. You should only use this option with known good media.
/C Creates an NTFS volume that the system compresses by default. Consequently, you won't need to perform this step separately later.
/X Forces the system to dismount the drive before formatting if necessary. Dismounting the drive closes all open handles.
/A:size Overrides the default allocation unit size for the hard drive. You can use this feature to optimize storage for specific tasks. For example, if you plan to store many small files, you might want to use a small allocation size. The size argument can include 512 bytes, 1,024 bytes, 2,048 bytes, 4,096 bytes, 8,192 bytes, 16 KB, 32 KB, and 64 KB cluster sizes for NTFS drives. You can't use compression on NTFS drives with a cluster size larger than 4,096. A FAT- or FAT32- formatted drive can use cluster sizes of 512 bytes, 1,024 bytes, 2,048 bytes, 4,096 bytes, 8,192 bytes, 16 KB, 32 KB, 64 KB, 128 KB, and 256 KB. You can only use the 128 KB and 256 KB options for a sector size greater than 512 bytes.
NOTE: FAT and FAT32 file systems impose a limit on the number of clusters per volume. A FATformatted drive can have 65,526 or fewer clusters. A FAT32-formatted drive can have any number of clusters between 65,526 and 4,177,918. The Format utility stops immediately when it detects that a drive can't meet the number of cluster requirements using the specified cluster size.
/F:size Specifies the size of the floppy disk to format. The default setting is 1.44 MB. You can specify this value as 1,440, 1,440k, 1,440kb, 1.44, 1.44m, or 1.44mb. The Format utility will also format 720 KB floppies. None of the Microsoft documentation specifies whether the utility formats 2.88 MB floppies. Theoretically, you can also format the very old 51/4-inch floppies with sizes of 640 KB and 1.2 MB. Use this option, whenever possible, instead of the /T and /N command line switches.
/T:tracks Specifies the number of tracks per side of the disk.
/N:sectors Specifies the number of sectors per track.
The format command provides a number of exit codes that you can use when working with batch files. The following list describes each of the exit codes.
0 The format completed successfully.
1 The format failed because you provided incorrect arguments.
4 A fatal error occurred. For example, the utility couldn't format the drive because the system has it locked for use. The Format utility uses this error when the 0, 1, or 5 codes don't apply.
5 The user pressed N when the utility asked whether it should proceed with the disk format. Pressing N always stops the formatting process.
/P:Passes Zeroes every sector on the hard drive the number of times defined by Passes. The /P command line switch makes it possible for you to erase the data on a hard drive more completely. However, the only certain way to ensure the data is gone is to destroy the hard drive completely and magnetically erase the media.
Loading Older DOS Applications with the LoadFix Utility
Some older applications don't load correctly. You'll see a "Packed file corrupt" error message when you try to load them. The LoadFix utility modifies the loading process for these applications so they load above the 64 KB area of memory used for operating system needs. This utility uses the following syntax:
LOADFIX [drive:][path]filename
The following describes the command line argument:
[drive:][path]filename Specifies the name and location of the file to modify.
In this tutorial:
- CMD and BAT Files
- Starting the Command Interpreter
- Using the CMD Switches
- Working with the Command Interpreter in the Registry
- Modifying Config.NT
- Displaying the Config.NT Commands
- Modifying AutoExec.NT
- Saving Memory Using the LH Command
- Defining Application Compatibility with the SetVer Utility
- Using Common DOS Utilities
- Formatting a Disk with the Format Utility
- Terminating a Session Using the Logoff Utility
- Managing Environment Variables with the Set Command
- Managing Environment Variables with the SetX Utility
- Using Debugging Utilities
- Working at the Command Prompt
- Managing Usernames and Passwords with CmdKey
- Changing Screen Colors with the Color Command
- Obtaining Command Line Help with the Help Utility
- Creating Batch Files
- Using the Choice Command
- Using the For Command
- Using the Goto Command
- Using the Prompt Command
- Using the WaitFor Utility