Resizing Volumes in Windows via DiskPart Utility

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:”

  1. At the command line, type diskpart and press Enter.
  2. List all the disks connected to your server.
    diskpart> list disk

    Disk ###        Status        Size          Free        Dyn     Gpt
    --------------  -------------  ----------  ---------  -------  ------
    Disk 0          Online          223 GB    123 GB
  3. Select a disk (in this scenario, “disk 0”) by typing the following command: diskpart> select disk 0
  4. 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
  5. 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.
  6. 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

  1. Determine the volume number ascribed to drive C: by typing the following command:
    diskpart> list volume
  2. Select the associated volume (in this scenario, “volume 1”) by typing the following command:
    diskpart> select volume 1
  3. 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.
  4. 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

  1. Determine the volume number ascribed to drive C: by typing the following command:
    diskpart> list volume
  2. Select the associated volume (in this scenario, “volume 1”) by typing the following command:
    diskpart> select volume 1
  3. 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.

GUI_pic1

Figure 1. Going to the Computer Management GUI

GUI_pic2

Figure 2. Disk Management GUI

  • 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.

See our Knowledgebase for more How-To articles.

Comments are closed.