The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Formatting and Resizing Partitions with Diskpart

    Discussion in 'Windows OS and Software' started by MadHouse24, Oct 13, 2010.

  1. MadHouse24

    MadHouse24 Notebook Consultant

    Reputations:
    4
    Messages:
    107
    Likes Received:
    0
    Trophy Points:
    30
    I got this article from WindowsITPros which has been around for a very long time in the IT field...this article talks about using diskpart to shrink and expand partitions in Windows:

    In last month’s example, we added an empty 24GB drive to a Windows system and created a 10GB partition by typing select disk 1 (which pointed Diskpart to the second physical hard disk) and create partition primary size=10240 (Diskpart prefers size information in megabytes). To complete this disk’s setup, we need to give it a drive letter with the Assign command, then format it with the Format command.

    The Assign command is simple: After you focus Diskpart on a partition or volume, you can give that partition/volume a drive letter (or change the existing drive letter) by typing assign [letter=<letter>]

    To set this partition’s drive letter to T, for example, you would use
    assign letter=t

    (If you don’t specify a letter, Diskpart automatically assigns the next available letter to the partition.)

    Now, you need to format the disk before you can use it. The syntax of Diskpart’s Format command is a bit different from the syntax of the native Format command that Windows OSs have had since DOS 1.0. It has many options, but in most cases these options will do the trick:

    From Madhouse: The only way I could get this command in here was to do this.... **look at the Search instead for part, this is the correct syntax http://www.google.com/search?hl=en&source=hp&q=format+fs%3D%3Cfilesystemtype%3E+%5Bquick%5D+%5Blabel%3D%3Clabel%3E%5D+%5Bunit%3D%3Cclustersize%3E%5D&btnG=Google+Search&aq=f&aqi=&aql=&oq=&gs_rfai=

    For example, you could format the partition quickly, allow Format to use the default cluster size, and label it “Data drive” by typing

    format fs=ntfs label=”Data drive” quick

    That command gives you a working disk volume, but what if you want to change the volume’s size? Since Windows Vista, Diskpart has been able to expand or shrink a partition/volume. Why shrink an existing volume? I’ve had to do it on a number of Vista and Windows Server 2008 systems because Windows’ useful BitLocker drive-encryption tool lets you encrypt entire OS drives—but only if you have the foresight to leave 1.5GB of unused space on the disk where the OS resides. Because Vista/Server 2008 Setup is sadly BitLocker-unaware (a problem that Windows 7 and Server 2008 R2 don’t share), many Vista/Server 2008 users carefully set up their systems, add BitLocker as a final touch, then find that Bitlocker won’t work without a 1.5GB partition. Oops!

    I’ve used Diskpart to help many people in this situation. The tool’s Shrink command reduces an existing partition’s size without damaging that partition. To shrink a partition/volume, I’d first select that partition or volume. For example, if I want to shrink the C drive on a system by 1.5GB, I would type list volume to determine the volume number that specifies the C drive (e.g., volume 2), select that volume by typing select volume 2, then type:

    shrink [desired=<sizeinmegabytes>] [querymax]

    In my example, I need to clear 1,500MB of free space so that I can create the partition that will make BitLocker happy. If I just type shrink without any parameters, Diskpart computes the maximum space it can extract from C, then shrink C by that amount. But I don’t want C minimized in size; I just want 1,500MB taken from it. So, I’ll add the desired= parameter:

    shrink desired=1500

    That command will give me the 1.5GB of space I need to set up that extra drive letter that Vista/Server 2008’s Bitlocker needs. To see how much space you can snatch from an existing drive, you can type shrink querymax.

    Consider the opposite situation. You have a volume on a drive that doesn’t fill that drive, leaving some precious disk space unused. How do you expand the volume to use all remaining space? You can use Diskpart’s Extend command:

    extend [size=<sizeinmegabytes>]

    As with Shrink, first shift Diskpart’s focus to the volume/partition you want to extend. Then, either type simply extend, which causes Diskpart to expand the volume/partition as much as possible, or constrain the extension with the size= parameter:

    extend size=100

    Diskpart’s ability to expand and shrink volumes is a welcome addition to the list of built-in Windows storage tools. Next month, we’ll take a look at a new-to-Windows-7 storage capability: the ability to create and manipulate drives packaged in VHD format.


    A Description of the Diskpart Command-Line Utility
    A Description of the Diskpart Command-Line Utility