Windows – Disk Space Cleanup – Software Distribution and more …

Sometimes you run out of disk space on a PC or even a Server !!

Especially on the C drive this will become serious to keep everything running smoothly.

Apart from deleting the rubbish, you can follow this procedure to free up major disk space.

Follow this procedure to get rid of the overload in :

C:\WINDOWS\SoftwareDistribution\Download

1. Is it safe to delete files in ?C:\WINDOWS\SoftwareDistribution\Download

Yes, taken in account you follow these steps :

cmd
net stop wuauserv
rename c:\windows\SoftwareDistribution Softwaredistribution.old
net start wuauserv

Verify that the new software distribution folder created when you restart the update service. You will notice it will create the missing subfolders again and populate ONLY the downloads that you are missing and not the whole historical downloads.

Restart the computer and del the folder if you have no issues.

Software Distributions Downloads is auto cleaned after a couple of weeks.
Purging more often than that can be done by stopping the service, clearing the downloads dir, then restarting WAU.

This will save you a lot of Gb’s !!

If this is not sufficient you can apply this try to relocate the folder and all the Gb’s to a different drive.

How to relocating the C:\WINDOWS\SoftwareDistribution folder

1. First stop the Windows update Service

image

Copy the folder and files to a new drive with enough space like the “D drive” in my case

 

On the “C Drive” rename the original folder to

C:\WINDOWS\SoftwareDistribution.old

Delete all the subfolders and data from this folder (which had copied to the D drive see above)

Create a new blank C:\WINDOWS\SoftwareDistribution folder

Next create a Symbolic link using Junction  from this new blank folder in the C drive to the copied folder on the D drive.

You can use this tool if needed

junction "C:\WINDOWS\SoftwareDistribution" "D:\WINDOWS\SoftwareDistribution"

image

 

Tip :

The JUNCTION.EXE tool is not needed anymore ! In fact it is outdated compared to the built-in tool MKLINK.

As of Windows Server 2008r2 you better use this command line tool.

image

See here for the difference between /D and /J

net stop wuauserv
mklink /D "C:\WINDOWS\SoftwareDistribution" "E:\WINDOWS\SoftwareDistribution"
net start wuauserv

image

Keep in mind that the LINK Directory may not yet exists !

So you need to delete the C:\WINDOWS\SoftwareDistribution before creating the link.

 

image

Check the result after restarting Windows Updates Service again.

Use this command :


dir /AL /S C:\windows

 

Done !

 

2. Is it safe to delete the  WinSxS folder

You should not be purged entirely, but you can clean up older and duplicate cache files with DISM:

https://blogs.technet.microsoft.com/askpfeplat/2014/05/13/how-to-clean-up-the-winsxs-directory-and-free-up-disk-space-on-windows-server-2008-r2-with-new-update/

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder

Windows 7 / Windows 2008r2 use this command :

dism /online /cleanup-image /spsuperseded

 

https://www.windowscentral.com/how-reclaim-space-reducing-size-winsxs-folder-windows-10#cleanup_winsxs_storagesense_windows10

Windows 10 / Windows 2016 use these commands :

dism /Online /Cleanup-Image /AnalyzeComponentStore

image

Windows 2016 Example

image

Next if cleanup recommended run this command

dism /online /Cleanup-Image /StartComponentCleanup

 

Also see here for more clean-up options :

System => Storage =>  Free Up space now …

image

Activate Storage Sense

image

image

 

See here for more info :

https://www.windowscentral.com/best-ways-to-free-hard-drive-space-windows-10#page1

Then, cleaning up temp spaces, such as with Disk Clean-up helps.

image

Clean-up System Files

image

Ultimately remove some Restore Points

image

 

3. Resize DataStore.edb Database

Run these commands

image

net stop wuauserv
esentutl /k %windir%\softwaredistribution\datastore\datastore.edb
net start wuauserv

image

net stop wuauserv
esentutl /d %windir%\softwaredistribution\datastore\datastore.edb
net start wuauserv

Reducing Windows Database

Windows.edb is located here :

C:\ProgramData\Microsoft\Search\Data\Applications\Windows\

image

https://support.microsoft.com/en-us/help/2838018/the-windows-edb-file-grows-very-large-in-windows-8-or-windows-server-2

Change the Windows Search service so that it does not automatically start. To do this,

Run the following commands in cmd.exe using Admin privileges :

image

Run the following commands to perform offline compaction of the Windows.edb file:


Sc config wsearch start=disabled
esentutl.exe /d %AllUsersProfile%\Microsoft\Search\Data\Applications\Windows\Windows.edb

 

image

Run the following command to change the Windows Search service to delayed start:

Sc config wsearch start=delayed-auto
net start wsearch

 

 

image

After Compacting it is save +/- 1 Gb Smile

You can do the same for the datastore.edb

image

 

net stop BITS
net stop wuauserv
esentutl.exe /d c:\Windows\SoftwareDistribution\DataStore\DataStore.edb
net start BITS
net start wuauserv

Actually you can do this for any EDB database you find on your system ! Winking smile

Like for example the Internet.edb

image

4. More tips on how to recover space is :

1. Windows – WSUS Database CleanUp Tool

2. Windows – Reading & Removing CBS.Log

 

Enjoy !

One Response to Windows – Disk Space Cleanup – Software Distribution and more …

  1. Superb, what a web site it is! This webpage presents helpful
    information to us, keep it up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: