Tuesday, October 13, 2020

How to free space on OS Windows drive by moving SoftwareDistribution folder to another disk via junction folder

If you are lucky owner of PC with 100Gb OS SSD disk or when OS disk on your server is not big enough then you may face with situation when there is no enough space anymore for installing updates, new tools, etc. In this post I will share solution which will help to free some space on OS drive.

Probably the first thing which you will try when will face with this problem is WinDirStat tool which allows to gather report of disk space usage per folders. The same report will most probably show that C:\Windows\SoftwareDistribution folder takes a lot of space. This folder is used by Windows Update for storing temporary files needed for installing new updates. As it is important Windows component you can’t just delete or move it and free space on OS drive. However what we can do is to create folder on another drive, move files there and create junction between C:\Windows\SoftwareDistribution and this folder. Here are needed steps:

1. Stop Windows Update service (Control Panel > Administration > Services)
2. Create new folder on another drive with enough space, e.g. D:\WinSoftwareDistribution. This is where files will be stored after all
3. Rename C:\Windows\SoftwareDistribution e.g .to C:\Windows\SoftwareDistribution.old
4. Create junction between folders:

mklink /j C:\Windows\SoftwareDistribution D:\WinSoftwareDistribution

5. Move files from C:\Windows\SoftwareDistribution.old to D:\WinSoftwareDistribution. After that you may go to C:\Windows\SoftwareDistribution junction and ensure that files appear there again
6. Run Windows Update service

After that your SoftwareDistribution will be located on another drive and you will have more space on your OS drive. Hope that this trick will help someone.

Update 2022-08-19: there may be side effects which this solution. Workaround for one of them is described here: Fix for "The system cannot open the device or file specified" error in Windows Installer.

No comments:

Post a Comment