An SSD comes with a lot of advantages. It’s quick and fast and makes your PC boot faster, which, you may argue, is the dream of any PC owner. But it also has its shortcomings in a way that it costs you an arm and a leg. Even though SSDs have been falling in price fast, they haven’t become as cheap as HDDs to replace them completely just as yet. With even a 128GB SSD costing as much as a 1TB HDD, you have to find a way to fit both these technologies belonging to two different eras in your configuration.
The obvious way is to use your SSD to store your operating system and to use your HDD to store your files. But the problem is that the softwares you may want to install get installed in the system partition (often the C drive). Consequently, your SSD might fill up quickly and the meager 128 or 256 GB you have in your SSD might prove to be inadequate.
Windows, for the time being, doesn’t support a configuration where you can have your softwares install into a custom drive. Though you can move your UWP apps (Apps installed through Microsoft store) to a different drive, the traditional softwares will still be installed in the system partition by default.
However, there is a workaround. With a combination of registry hacks, junction links, and Sysprep tool, you can move the bulk of your C drive to a new drive on your HDD.
Let’s get started.
Before we begin, this works only if you are planning to install Windows 10 from scratch. I haven’t yet come across a way to do the same on an existing Windows 10 installation.
The chief culprits
The following folders are the ones that consume the majority of the space in your system partition.
- Program Files
- Program Files (x86)-If yours is a 64bit PC
We need to find a way to move all of these folders to a different drive (in my case the D drive).
The Users folder
The only way to move the Users folder to a different drive without breaking your system is to use the System Preparation tool. The System Preparation tool is used to install pre-configured Windows 10 installations across multiple devices. We can use this tool to achieve our goal.
First, you need to create an XML file and save it in the root of any drive except the C drive. Open the Notepad app and paste the following code into it.
<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <FolderLocations> <ProfilesDirectory>D:\Users</ProfilesDirectory> </FolderLocations> </component> </settings> </unattend>
There are two things you may want to change in this file. If yours is a 32-bit machine, then replace “amd64” in the processorArchitecture attribute with “x86”. The ProfilesDirectory attribute specifies the new location of the Users folder. If you want to move it to a different location, you need to specify it here. Once done, save this file with a .xml extension in the root of a drive.
Then, open the command prompt as the administrator. An easy way of doing it is to open Cortana or Search (if you’re using the 1903 build of Windows 10) and type CMD. Right click on Command Prompt and select “Run as Administrator”.
Now, we need to stop the WMP Network Sharing Service. This wouldn’t be running most probably but we need to make sure that this is not running to make sure Sysprep doesn’t fail.
Enter the following command to stop the service:
net stop wmpnetworksvc
Once that’s done, it’s time we run the Sysprep tool.
%windir%\system32\sysprep\sysprep.exe /oobe /reboot /unattend:d:\relocate.xml
d:\relocate.xml refers to the XML file you created. Replace this with the address of your file.
This will perform an Out of the Box Experience (OOBE) boot. Once the reboot is completed, you will find the Users folder in the location you specified.
The above steps were learned from https://www.tenforums.com/tutorials/1964-move-users-folder-location-windows-10-a.html
Programs Files and Program Files (x86)
Well-mannered and civilized programs will have the courtesy to ask you where you want them to be installed during installation. But not all programs are well-mannered or civilized. Some (Most?) would directly barge into your Programs Files in the system partition. So, it is important that the default location of the Programs Files folder is changed so that programs will be installed there.
To do this, we need to edit the Registry.
Win+R to launch run and open the registry editor by entering
regedit and hitting enter. Then navigate to the following directory.
Once you open CurrentVersion, you will be able to see several keys with values pointing to the Program Files folder in the C drive. Double click on each key and edit their path to point to the drive where you want your programs to be installed.
Restart your PC when you are done. When this step is completed, softwares will be installed in the drive you specified by default.
The ProgramData folder
Most programs store some of their files in the ProgramData folder in the C drive. For instance, your Start screen shortcuts are all placed in this folder. Over time, this folder can grow large in size and might end up hogging a great chunk of your storage space. Unfortunately, there exists no way by which this folder can be moved to another drive.
Here is where junction links come to our rescue. Junction links is a native Windows feature that lets you create a link to a file or a directory in a certain partition or drive in another drive or partition. This fools application into thinking that your files exist in the path where your link is despite them residing in a completely different location.
We can move our ProgramData folder to a different drive and create a junction link to that directory in our C drive. This will allow softwares to access the ProgramData folder in the C:\ProgramData path but the actual directory will be in the path that you chose.
Since applications running can prevent us from moving the ProgramData folder, it is advisable to move the ProgramData folder to a different drive using the command prompt in the advanced startup mode. To enter advanced startup, hold shift and click on restart, and then select command prompt under the troubleshoot option.
To move folders, robocopy is a better tool than the standard copy tool available in the cmd. To move your ProgramData folder from your C drive to your D drive, enter the following command.
robocopy C:\ProgramData D:\ProgramData /e /move
e option copies subdirectories including the empty ones to the new location while the
move option tells the tool to delete the source directory once the copying is complete.
Now it’s time to create the junction link. To create a link in your C drive, cd into your C drive and enter the following command: (Note that this can only be run in the command prompt with administrator privileges. Powershell doesn’t support this.)
mklink /j C:\ProgramData D:\ProgramData
Now, as you can see in the screenshot, a link has been created in the C drive which points to the ProgramData folder in the D drive. You can use this link to access the ProgramData folder in the D drive as if the folder is actually in the C drive.
Now, when you install programs, the files supposed to be stored in the ProgramData folder in the C drive will be stored in the D drive.
Other files and folders
For some reason, 32-bit applications by default still tend to store their files in the C drive. Even though most applications will allow you to change the installation directory during the course of the installation, some may install in the default directory. There are also applications coded by lazy programmers that have the path to the Program Files directory hardcoded in their installation package that changing the default directory in the registry has no effect in them. They end up installing the files in the C drive.
To move such files installed by different applications, use the method that was used to move the ProgramData directory. Just move those directories to the D drive and create a junction link in their place in the C drive.
For example, the folder above takes close to 5.5 GB in my C drive even though the software was installed in the D drive. I simply moved the folder to the D drive and created a junction link in the C drive so that the softwares that need access to this directory can still do so through the link.
Moving apps from the Microsoft Store to another drive
The apps you install from the store are stored in the C drive. This can be changed to another drive by going to
Settings->System->Storage->Change where new content is saved.
The above methods help you reduce space consumption in your system drive allowing you to avail yourself of the speed afforded by SSDs while circumventing the space limitation.
Originally published at https://www.thearmchaircritic.org on June 12, 2019.