As you know by now, the system partition (meaning the partition on which the operating system is installed on) is a place that just begs for more space as time goes by. In most cases, proper design before the installation of the operating system will prevent you from having to extend that system partition (read more about it in my article on how to extend the system partition in Windows 7 ).
However, in some rare cases, there is a need to shrink the system partition and make room on the disk for something else, perhaps a new partition that could be used to store personal files, the pagefile or whatever.
Previous Microsoft operating systems had some internal mechanism to shrink partitions. But there were limitations on these operations. Some 3rd-party applications could (and still can) be used to extend partitions, but in this article, like the one mentioned above, we want to focus on internal tools.
Windows 7 allows for an easy, out-of-the-box, method of shrinking partitions (any partition, including the system partition) and making them smaller.
Like when extending a partition, shrinking a partition is done by using the Extend feature in Disk Management, or in the DISKPART command line executable.
Note: When you shrink a partition, all data on the existing partition will NOT be erased, but it’s better to be safe than sorry, therefore I always recommend using a good backup procedure to back up your data, just in case.
Note: While this article is specifically discussing shrinking system partitions, the procedures outlined here can be used to shrink ANY partition, not just the system partition.
Also note that shrinking the system partition does not require a reboot.
Basically, there are 2 methods of shrinking the system partition in Windows 7:
1. Log on as an Administrator.
2. Go to Control Panel > System and Maintenance > Administrative Tools > Computer Management. You can also open the Computer Management application by using the Computer context menu. Select Computer Management.
In fact, you can go directly to the Disk Management MMC snap-in by typing diskmgmt.msc in the Start’s search box or on the Run command.
If you’re prompted for an administrator password or confirmation, type the password or provide confirmation.
3. Expand the Storage section, and in it go to the Disk Management console.
4. Select the disk you want to shrink, for example Drive C.
5. Right-click the disk and select Shrink Volume.
6. Process will take a few moments, while the system is looking at the partition structure. Note that it would be best to make sure that that partition was properly defragmented prior to trying to shrink it.
7. When calculation is done, the UI will display the largest amount of space that can be trimmed from the selected partition. Please note, again, that this size is related to the actual amount of free space on that partition (i.e. you cannot shrink more that there is free space), and the amount of file fragmentation on that partition.
Enter the amount in MB and click on the Shrink button.
8. The process will finish quite quickly, and a reboot is NOT required. You can notice the new partition size. Also note that you now have a remaining unused part on the hard drive.
Extending a partition or volume can be done via the CLI, or command line interface. In order to do that perform the following steps:
1. Click Start and type CMD, then press Enter. It is best to run the Command Prompt as an Administrator. To do so, right-click CMD and select “Run as Administrator”.
BTW, you can also hover over the CMD line and press CTRL + SHIFT + ENTER to invoke the “Run as Administrator” shortcut.
2. In the command prompt type
Diskpart
3. Select the right disk drive and partition to work on. Typically, in Windows 7, this should be disk 0 and partition 2, but please make sure you do select the right disk and partition before continuing. You can do so by performing a LIST operation to view your existing disks and partitions BEFORE attempting to expand the wrong partition.
List disk
Select disk 0
List partition
Select partition 2
4. When the right disk and partitions were selected, run the SHRINK command which reduces the size of the volume with focus by the specified amount, and makes free disk space available from unused space at the end of the volume.
SHRINK has some parameters we need to talk about:
DESIRED=<N> – Specifies the desired amount of space in megabytes (MB) to reduce the size of the volume by. If a desired amount is not specified, the volume will be reduced by the maximum amount of free space available on the volume.
MINIMUM=<N> – Specifies the minimum amount of space in MB to reduce the size of the volume by.
QUERYMAX – Returns the maximum number of bytes that the volume can be reduced by (the free space available on the volume). This value may change if applications are currently accessing the volume.
If a MINIMUM amount is not specified, the volume will be reduced by either the DESIRED amount (if specified), or by the maximum amount of free space available on the volume. If a MINIMUM amount is specified but not enough free space is available, the command will fail. This command works on basic volumes, and on simple or spanned dynamic volumes. You can reduce the size of a volume only if it is formatted using the NTFS file system or if it does not have a file system.
For example:
Shrink QUERYMAX
The above command will return the maximum number of bytes that the volume can be reduced.
shrink DESIRED=500 MINIMUM=250
Will shrink the partition by 500 MB, if possible, and if it cannot shrink by 500 MB, it will at least attempt to shrink it by 250 MB.
shrink DESIRED=10000
Will shrink the partition by 10000 MB.
5. You may check the new partition size by running the list command, again.
List partition
6. You must now exit DISKPART by using the Exit command.
Exit
BTW, as a general tip and so that you know, you can use the above procedures also on Windows Vista, Windows Server 2008 and Windows Server 2008 R2.