Changes

Jump to: navigation, search
Formatting a Volume from the Command Line
== Formatting a Volume from the Command Line ==
 
Windows Server 2008 prvides the ability to format volumes from the command line using the '''diskpart'' tool. This can be invoked by entering ''diskpart'' either at the command prompt or in a Run dialog. Once started diskpart presents a ''DISKPART'' promot at which commands can be entered.
 
The first step is to identify the disks on the system. This information is obtained using the list disk command:
 
<pre>
DISKPART> list disk
 
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 30 GB 0 B
Disk 1 Online 10 GB 0 B
</pre>
 
For the purposes of this tutorial we will be working on a partition on disk 1. To select the required disk use the select disk command:
 
<pre>
DISKPART> select disk 1
 
Disk 1 is now the selected disk.
</pre>
 
Having selected the disk the next step is to select the partition which is to be formatted. To obtain a list of partitions on the selected disk the list partition command is used:
 
<pre>
DISKPART> list partition
 
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 1000 MB 1024 KB
Partition 2 Primary 1000 MB 1001 MB
Partition 3 Primary 998 MB 2001 MB
Partition 0 Extended 7238 MB 3001 MB
Partition 4 Logical 1000 MB 3002 MB
Partition 5 Logical 6236 MB 4003 MB
</pre>
 
For this example we are going to format parition 3 so need to select this partition using the ''select partition'' command:
 
<pre>
DISKPART> select partition 3
 
Partition 3 is now the selected partition.
</pre>
 
Having made the appropriate selections we are now ready to format the chosen partition. As with formatting through the Disk Management interface a number of options are available. In the first instance the type of file system required must be specified using the ''fs='' directive. Acceptable options include FAT, FAT32 or NTFS. Alternatively simply use ''recommended'' to format using the recommended file system. The ''label='' directive allows a volume label to be specified. When using this directive the label name should be encapsulated in double quotes (").
 
In addition the ''quick'' directive can be used to perform a quick format where the dis is not checked for errors and ''compress'' may be used with an NTFS format to enable file and folder compression.
 
The following example performs a quick format of the currently selected partition as NTFS with a volume label of "My Volume":
 
<pre>
DISKPART> format fs=ntfs label="My Volume" quick
 
100 percent completed
 
DiskPart successfully formatted the volume.
</pre>

Navigation menu