(Is your server not living up to its potential? Order a server from us with promo code PACKETS for 15% off your first invoice)
The DiskPart utility enables you to configure storage from a script, a remote session, or another command prompt. It is different from other command-line tools, as it does not operate in a single-line mode. In DiskPart, your commands are read from standard input/output (I/O) and directed to any disk, partition, or volume.
DiskPart enhances the Disk Administrator graphical user interface (GUI). Specifically, it can do a superset of actions supported by Disk Management.
The C: drives of Alnitech servers has a 100GB default volume. You can use the rest of the space at your own discretion.
You can find a list of the DiskPart commands you can use in this Microsoft TechNet article.
Some quick notes before you get started:
- List then select an object to give it focus. Any DiskPart command will then act on that object.
- Adding extra space to an existing file system requires no downtime.
- Shrinking a file system requires no downtime as well.
________________________
Creating a new volume
Scenario: Create a new volume “data drive†with 10GB of space and mount it as “T:â€
- At the command line, type diskpart and press Enter.
- List all the disks connected to your server.
diskpart> list diskDisk ###    Status     Size      Free     Dyn   Gpt --------------  ------------- ----------  ---------  -------  ------ Disk 0      Online      223 GB   123 GB
- Select a disk (in this scenario, “disk 0â€) by typing the following command:Â
diskpart> select disk 0
- To create a partition (in this scenario, with 10GB size), type the following command:
diskpart> create partition primary size=10240
You can see the result by typing the following command:diskpart> list partition
Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 Primary 350 MB 1024 KB Partition 2 Primary 100 GB 351 MB * Partition 3 Primary 10 GB 100 GB
- To set this new partition’s drive letter to “T,†type the following command:
diskpart>assign letter=t
Note: If you do not specify a letter, DiskPart automatically assigns the next available letter to the partition. - You can opt to format the disk before you use it:
diskpart>format fs=ntfs label="Data drive" quick
Shrinking the size of a volume
Scenario: Shrink the system volume (drive C:)Â by 10GB
- Determine the volume number ascribed to drive C: by typing the following command:
diskpart> list volume - Select the associated volume (in this scenario, “volume 1â€) by typing the following command:
diskpart> select volume 1 - To shrink this volume, type the following command:
diskpart> shrink desired=10240
Note: If you just type ‘shrink’ without any parameters, DiskPart computes the maximum space it can extract from the volume and then shrink selected volume by that amount. - To see how much space you can snatch from an existing drive, type the following command:
diskpart> shrink querymax
DiskPart’s shrink command reduces an existing partition’s size without damaging said partition.
Expanding the size of a volume
Scenario: Expand the system volume (drive C:) by 10GB
- Determine the volume number ascribed to drive C: by typing the following command:
diskpart> list volume - Select the associated volume (in this scenario, “volume 1â€) by typing the following command:
diskpart> select volume 1 - To expand this volume, you can do either of the following options:
Option 1: To expand the volume/partition as much as possible:diskpart> extend
Option 2: To constrain the extension within a specific size parameter:diskpart> extend size=10240
Using the Windows GUI for resizing
Alternatively, you can use the Computer Management GUI in Windows to do volume resizing tasks.
- To create a new volume and mount it a drive letter:Computer Management > Disk Management > Select unallocated disk space you need > Right-click mouse button > New Simple Volume > Select needed size > Assign drive letter > Format partition
- To shrink or expand volumes:Computer Management > Disk Management > Select the partition you wish to shrink/expand > Right-click on the mouse button to shrink or expand.
Make sure you have sufficient space to make these changes.