Changes

Jump to: navigation, search
no edit summary
== 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 tool 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>
having Having selected the disk the next step is to select the partition which is to be reduced in size. To obtain a list of partitions on the selected disk the ''list partition'' command is used:
<pre>
The above screen lists any disks which are available to assign space to the partition being extended. In the case of dynamic disks space may be allocated from any disks available on the system. In the case of basic disks only space from the current disk are available. Since this is a basic disk the current disk drive is already placed in the ''Selected'' column. Define the amount of space to use for the volume extension using the ''Select the amount of space in Mb'' field. If the ''Next'' button is disabled it means that more space has been requested than is available on the disk. Reduce the size of the space until the ''Next'' button is enabled and click on it to proceed to the summary screen. Assuming the summary matches the reuqirements requirements of the extension click on ''Finish'' to extend the volume. == Extending a Partition from the Command Line == As with shrinking partitions, Windows Server 2008 allows disk volumes and partitions to be exdtended 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 tool 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 once again 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 extended. 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 551 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 extend 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 decide on the amount by which the partition can be extended. The ''extend'' command be used in a number of different ways. For example, a partition may be extended by a specified number of Mb by using the ''size='' option. For example, to increase the size of a partition by 3Gb: <pre>DISKPART> extend size=3000 There is not enough usable free space on specified disk(s) to extend thevolume.</pre> Clearly, in this case, the disk does not have sufficient free space to fulfill our extension request. An alternative approach is to let diskart allocate all the available space to the selected partition. This avoids the need to know how space is actually available:  <pre>DISKPART> extend DiskPart successfully extended the volume.</pre> In the case of dynamic disks, the extend command can also be used to allocated disk space from other disk drives. In this case the ''disk='' directive must be specified as part of the extend command. For example to extend the currently selected partition by 6Gb using space from disk 2: <pre>DISKPART> extend size=6000 disk=2</pre>

Navigation menu