Changes

Jump to: navigation, search
Shrinking a Partition from the Command Line
== Shrinking a Partition from the Command Line ==
In addition to the Disk Management interface, Windows Server 2008 allows disk volumes and partitions to be shrunk from the command-line using the '''diskpart''' tool. Invoke this tool by typing ''diskpart'' at a command prompt or in a Run dialog box. The toll will start and display a ''DISKPART>'' prompt.
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 reduced in size. 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 shrink parition 3 so need to select this partition using ''select partition'':
 
<pre>
DISKPART> select partition 3
 
Partition 3 is now the selected partition.
</pre>
 
With the appropriate disk and partition selected the next task is to identify the amount by which the partition can be reduced. To aid in this calculation the diskpart ''shrink query max'' command is used:
 
<pre>
DISKPART> shrink querymax
 
The maximum number of reclaimable bytes is: 448 MB
</pre>
 
As indicated in the above output, the partition may be reduced in size by a total of 448Mb. To perform the size reduction the ''shrink desired'' command is used:
 
<pre>
DISKPART> shrink desired 447
 
DiskPart successfully shrunk the volume by: 447 MB
</pre>
 
The partition has now successfully been reduced in size.
== Extending a Partition Using Disk Management ==

Navigation menu