How can I shrink a Windows 10 partition?

There seems to be absolutely no need for any third party software.

I have followed the instructions here, and I successfully shrank my OS partition in about 10 minutes. Running under Windows 10, but I doubt it makes a difference here.

The steps are:

  1. Disable hibernation.

    At a an elevated (admin) command prompt, run the command

    powercfg /h off
    
  2. Disable pagefile.

    Open the System page in Control Panel (from “This PC”/“My computer”, open the Properties). Click “Advanced System Settings”, then in the “System Properties” dialog's “Advanced” tab, open the “Performance” settings, go to the “Advanced” tab, click “Change...” under “Virtual memory”, untick “Automatically manage paging file size for all drives”, select the drive you want to shrink, select “No paging file” and click the “Set” button.

  3. Disable system protection.

    In the “System Properties” dialog as above, go to the “System Protection” tab, click “Configure...” and select “Disable system protection”.

  4. Restart.

Now the three files that were preventing partition reduction are gone. Reduce partition size, and then restore the three items.

If Disk Management complains that “There is not enough space available on the disk(s) to complete this operation.” even though you entered a size that should work according to Disk Management's own figures, see Cannot shrink C: partition: Not enough space

I have later found similar instructions at other places, all of them mentioning only these 3 items.


The interesting fact which often goes unsaid is that after a partition shrink the minimum size is also reduced (of course, if you have free space, defragged, no unmovable files, etc).

I used this method to successfully shrink a System volume (C:) on Windows Server 2012R2 from 500GB (with only 50GB of actual data) to 80GB. The first time I tried to resize it the minimum size was around 425GB.

Tip: If your volume is not a System one you may wish to skip the initial steps (before Restart)

  • Open a Powershell prompt with administrative rights.

  • First, disable settings which can keep unmovable files

    • Disable Pagefile

      wmic computersystem set AutomaticManagedPagefile=False
      wmic pagefileset where name="C:\\pagefile.sys" delete
      
    • Disable Hibernation (desktop Windows only)

      powercfg /h off
      
    • Disable System Restore (desktop Windows only)

      Disable-ComputerRestore -Drive C:
      
    • Restart the computer

  • Defrag (equivalent to defrag C: /L /D /K /G /H)

    Optimize-Volume -DriveLetter C -ReTrim -Defrag -SlabConsolidate -TierOptimize -NormalPriority
    
  • Get the remaining size in GB

    (Get-Volume C).SizeRemaining /1GB
    374,10312271118       # Sample result!
    
  • Resize partition (use the above value plus 2~3GB)

    $part = Get-Partition -DriveLetter C
    $part | Resize-Partition -Size 375GB
    
  • Get the remaining size again. Resize-Partition reduced it.

    (Get-Volume C).SizeRemaining /1GB
    278,10312271118       # Magic!
    
  • Rinse & repeat until you reach the desired size.

  • Finally, restore computer settings

    • Enable Pagefile

      wmic pagefileset create name="C:\\pagefile.sys"
      wmic computersystem set AutomaticManagedPagefile=True
      
    • Enable Hibernation (desktop Windows only)

      powercfg /h on
      
    • Enable System Restore (desktop Windows only)

      Enable-ComputerRestore -Drive C:
      
    • Restart the computer


The answer by @sancho.s works, but I'll leave this here in case anyone is looking for a quicker approach and is comfortable with third party tools.

As the comments point out, the problem was files that couldn't move during a partition shrink or defrag because they were locked by running applications and by windows. The simplest way to unlock those files is to stop the processes, and the simplest way to stop the processes is to not let them start! Hence, I started looking for a boot time defragment tool.

As recommended by @LưuVĩnhPhúc, I used this (free) partition manager, so I didn't need to defragment after all. Just start the tool, queue a partition job, and restart your computer:

  1. Start the tool, click the partition to resize, and click Move/Resize:

    enter image description here

  2. Set the size and click OK:

    enter image description here

  3. Apply the changes!

    enter image description here

  4. If you're shrinking lots like I was, it will prompt you to do it at reboot. Just restart the computer from the dialog box and sip your coffee for a bit.

    enter image description here


The key point is this part of the info message you posted:

You cannot shrink the volume beyond the point where any unmovable files are located.

From Microsoft's Shrink a Basic Volume:

Additional considerations

  • When you shrink a partition, certain files (for example, the paging file or the shadow copy storage area) cannot be automatically relocated and you cannot decrease the allocated space beyond the point where the unmovable files are located. If the shrink operation fails, check the Application Log for Event 259, which will identify the unmovable file. If you know the cluster or clusters associated with the file that is preventing the shrink operation, you can also use the fsutil command at a command prompt (type fsutil volume querycluster /? for usage). When you provide the querycluster parameter, the command output will identify the unmovable file that is preventing the shrink operation from succeeding.

    In some cases, you can relocate the file temporarily. For example, if the unmovable file is the paging file, you can use Control Panel to move it to another disk, shrink the volume, and then move the page file back to the disk.

  • If the number of bad clusters detected by dynamic bad-cluster remapping is too high, you cannot shrink the partition. If this occurs, you should consider moving the data and replacing the disk.

    Do not use a block-level copy to transfer the data. This will also copy the bad sector table and the new disk will treat the same sectors as bad even though they are normal.

  • You can shrink primary partitions and logical drives on raw partitions (those without a file system) or partitions using the NTFS file system.

You should first check the Application Log as indicated. If the unmovable file is the paging file, you can try to (temporarily) relocate it to another drive, then retry shrinking. However, if there are other unmovable files that prevent shrinking which you can't remove/relocate, then you won't be able to shrink using the builtin facility. In that case you'll need to use a 3rd party partitioning/imaging tool - there exist both free and paid such tools.