28

Space on my SSD is running pretty low, and there seems to be a 19GB folder in Windows that sticks out (%windir%\Installer) and cannot be safely deleted (as explained here: https://serverfault.com/q/15746).

Now, the mklink provides a neat little thing called Junction links - if I boot in cmd prompt, and move all of the files to the other hard drive, and then run this:

mklink /J C:\Windows\Installer D:\Windows\Installer

Will I be messing up my Windows in some way, or is this an OK thing to do? Will folder permissions/attributes stay the same across the link?

I've used hard links before, and it worked like a charm freeing up my SSD significantly, but I've never tried it on system folders (I don't see why it wouldn't work, but I'm not in the mood of reinstalling entire windows in case I'm wrong)

veljkoz
  • 825

5 Answers5

36

OK, I've taken the risk and it was worth it - everything works normally, but I have freed the 17GB on my SSD now.

Basically, the steps are:

  1. Restart your PC, press F8 continuously to bring up boot menu, and choose "Command prompt with safe mode" (this is to ensure you can move the windows folder around)
  2. Once the command prompt is shown, type the command to move the folder to another drive:
    robocopy C:\Windows\Installer D:\Windows\Installer /MOVE /e
  3. Next, create a "Junction" link for the missing folder:
    mklink /J C:\Windows\Installer D:\Windows\Installer

Of course, this assumes that your %WINDIR% is C:\Windows, that your D drive is the one with more space, that you want your destination in "D:\Windows\Installer" (it could be any folder, just be consistent) etc...

This should do the trick.

veljkoz
  • 825
3

While attempting to reclaim space on my main drive, an 120GB SSD, I found these instructions on how to relocate Users, Program Files, Program Files (x86), and ProgramData. It includes some registry edits "to set default locations", as follows:

  1. Replace drive letters of paths listed at HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion (for example C:\Program Files\Common Files would become D:\Program Files\Common Files)
  2. Replace environment variables %SystemDrive% with drive path at HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/ProfileList (i.e. %SystemDrive%\ProgramData would become D:\ProgramData)
Adam Cox
  • 131
3

You can use same trick for pagefile.sys and swapfile.sys (not sure if also for hiberfile.sys, not tested since i hate hibernating on multi-boot).

Just ensure to deactivate virtual ram and reboot prior to create the symlinks, then after creating them reactivate virtual ram.

I tend to create (with notepad) an empty file on destiny of the link prior to create the link.

Remember: When Windows10 UpGrade it will remove the links and put real files, after UpGrades you can repeat the process.

Working upto Windows 10 version 1803.48, since WindowsXP (oldest i had tried).

2
  1. Copy C:\Windows\Installer to another disk such as D:\C\Windows\Installer.
  2. Check and compare sizes of both folders if the source directory on C: has not been changed during copying.
  3. Rename folder on disk C:, e.g. Installer => InstallerX
  4. Run the command as an admin and launch run this command:
    • mklink /d C:\Windows\Installer D:\C\Windows\Installer
  5. Wait some time (few day) if everything is OK.
    • If yes, you can delete backup the folder C:\Windows\InstallerX.
    • If no, delete symbolic the folder C:\Windows\Installer and rename back InstallerX to Installer, or copy back the folder D:\C\Windows\Installer to C:\Windows\Installer.
2

I took similar steps, but I wanted to be able to use my computer while I did the file copy (my folder was 40 GB).

  1. Manually copy the folder to F:\Installer
  2. I am using Windows 8.1, so to get to a command line boot I held Shift while I clicked Restart, then clicked Advanced
  3. Once in the command line, I had to figure out which drive letter to use (it wasn't C: even though that is my %SystemDrive% when my OS is fully booted). I had to use echo list volume | diskpart to find out that the C: drive was now referred to as E: and the F: drive was still the F: drive
  4. I removed the hidden and system attributes on E:\Windows\Installer with attrib -s -h E:\Windows\Installer and renamed it with rename "E:\Windows\Installer" "Installer_old"
  5. I could then create the junction with mklink /J E:\Windows\Installer F:\Installer
kevinpo
  • 121