Diskpart Command Lines in Windows 7

Monday, December 26, 2016 by Max

Diskpart command prompt is the default disk managing tool along with Disk management, unlike graphic design in which, diskpart manages disk in command lines, preferred by pro or advanced users, or Server administrators. We'll share some useful command lines in this page on how to extend and shrink partition in Windows 7, format NTFS to FAT32 and convert GPT to MBR methods.

NOTE: Format and Convert command lines will cause data loss in partitions or disk, do keep in mind to backup data before proceed.

The following steps require to Run CMD.exe as administrator, so click Start button first, and type in CMD in the box, right-click on CMD.exe and run it as administrator.

1. Extend Partition in CMD


              Microsoft Windows [Version 6.1.7601]
              Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
              C:\Windows\system32>diskpart
              Microsoft DiskPart version 6.1.7601
              Copyright (C) 1999-2008 Microsoft Corporation.
              On computer: WIN-A82KHKU60PJ
              DISKPART> list volume
                Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
                ----------  ---  -----------  -----  ----------  -------  ---------  --------
                Volume 0     Z                       DVD-ROM         0 B  No Media
                Volume 1     C                NTFS   Partition    400 GB  Healthy    System
                Volume 2     E                NTFS   Partition     99 GB  Healthy
                Volume 3     F   New Volume   NTFS   Partition     77 GB  Healthy
                Volume 4     H                NTFS   Partition     36 GB  Healthy
                Volume 5     G                NTFS   Partition     80 GB  Healthy
              DISKPART> select volume h
              Volume 4 is the selected volume.
              DISKPART> extend
              DiskPart successfully extended the volume.
              DISKPART>
              

2. Shrink Partition in CMD


              Microsoft Windows [Version 6.1.7601]
              Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
              C:\Windows\system32>diskpart
              Microsoft DiskPart version 6.1.7601
              Copyright (C) 1999-2008 Microsoft Corporation.
              On computer: WIN-A82KHKU60PJ
              DISKPART> list volume
                Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
                ----------  ---  -----------  -----  ----------  -------  ---------  -------
                Volume 0     Z                       DVD-ROM         0 B  No Media
                Volume 1     C                NTFS   Partition    400 GB  Healthy    System
                Volume 2     E                NTFS   Partition     99 GB  Healthy
                Volume 3     F   New Volume   NTFS   Partition     77 GB  Healthy
                Volume 4     H                NTFS   Partition     41 GB  Healthy
                Volume 5     G                NTFS   Partition     80 GB  Healthy
              DISKPART> sel volume h
              Volume 4 is the selected volume.
              DISKPART> shrink desired=1024
              DiskPart successfully shrunk the volume by: 1024 MB
              DISKPART>
              

3. Format to NTFS partition


              Microsoft Windows [Version 6.1.7601]
              Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
              C:\Windows\system32>diskpart
              Microsoft DiskPart version 6.1.7601
              Copyright (C) 1999-2008 Microsoft Corporation.
              On computer: WIN-A82KHKU60PJ
              DISKPART> list volume
                Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
                ----------  ---  -----------  -----  ----------  -------  ---------  --------
                Volume 0     Z                       DVD-ROM         0 B  No Media
                Volume 1     C                NTFS   Partition    400 GB  Healthy    System
                Volume 2     E                NTFS   Partition     99 GB  Healthy
                Volume 3     F   New Volume   NTFS   Partition     77 GB  Healthy
                Volume 4     H                NTFS   Partition     40 GB  Healthy
                Volume 5     G                NTFS   Partition     80 GB  Healthy
              DISKPART> sel volume h
              Volume 4 is the selected volume.
              DISKPART> format fs=ntfs quick label=data
                100 percent completed
              DiskPart successfully formatted the volume.
              DISKPART>
              

4. Convert GPT to MBR


              Microsoft Windows [Version 6.1.7601]
              Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
              C:\Windows\system32>diskpart
              Microsoft DiskPart version 6.1.7601
              Copyright (C) 1999-2008 Microsoft Corporation.
              On computer: WIN-A82KHKU60PJ
              DISKPART> list disk
                Disk ###  Status         Size     Free     Dyn  Gpt
                --------  -------------  -------  -------  ---  ---
                Disk 0    Online          500 GB      0 B
                Disk 1    Online          200 GB  1024 MB        *
              DISKPART> sel disk 1
              Disk 1 is now the selected disk.
              DISKPART> convert mbr
              
TOP