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