Friday, July 30, 2021

How to Use Auxiliary Storage on Windows

 A lot of newer development and desktop Windows machines are equipped with a barely adequate solid state drive (SSD) as the system drive, and an auxiliary hard disk drive (HDD). Out of the box, Windows is barely aware of the auxiliary storage. There's a drive letter, but that's about it. If you want to actually use the HDD, you have to manage it yourself.

You can tell Windows to change where new content is saved, and it lets you select your 'other' drive(s), but that can cause other problems. First off, it doesn't seem to follow the /Users/username/Documents pattern, but rather just goes /username/Documents. So finding things is confusing. It doesn't change your home directory, so if you open a command window, it will be in e.g., C:/Users/username. 

Start Menu > System > Settings > Storage

This feature actually seems to make matters worse. I would much rather that Windows copy all user data to a new location (wherever that is), and create a symbolic link in the original location that points to the new location. That would prevent existing apps having to be updated with the new location. Windows could keep the same C:/Users/username, but it would go to the new location.

A lot of apps will keep saving their user data in C:/Users/username. Some of them put lots of data in there. For example, Netbeans, Audacity, Maven, Office 365...

The Windows file system has symbolic links. A few different kinds, but for this discussion, you want a 'junction'. You might be tempted to copy your entire C:/Users/username folder to another drive, and create a junction to it. I think it would probably work, for the most part, but I have heard of problems with this approach. A better solution would be to create links to specific folders that are notorious for hogging a lot of space. 

For example, the Maven repository, .m2, can become incredibly large, since it contains the downloaded libraries of all the dependencies for software projects. I moved it to D:/Users/username/.m2 (D drive is my HDD, and I just mirrored the '/Users/username/' part, for consistency). I could have told Maven where I want the .m2 repo to go, but I have several tools that use Maven, and between installs and reconfigurations, I invariably find .m2 on my C drive. It's easier just to make a junction and forget about it. Then everyone gets the same standard configuration.

OneDrive has to get into the act, and it can really discombobulate things. OneDrive sees your standard 'libraries' (Documents, Downloads, Desktop, Pictures, Music, Videos, etc., and literally moves those from their usual location, to inside the OneDrive folder. I'm not kidding: if you go to C:/Users/username/Documents, and OneDrive got ahold of it, your Documents folder will be empty. 

This can cause confusion, and still hog the C: drive. But don't use a junction for OneDrive. The recommended procedure is to go into your OneDrive account settings, and tell OneDrive to unlink the computer. Once OneDrive logs you out, copy the OneDrive folder to the desired new location. Then 'set up' your new-old account, and tell OneDrive where you want it to keep your stuff. When OneDrive warns you that your specified location already contains data, just say not to duplicate it.

I think an even better approach, if OneDrive has finished syncing, is to sign out of OneDrive and just delete the old OneDrive folder. Then log back in to OneDrive and tell it to use the new (empty) location. OneDrive will simply download all your content from the cloud. 

No comments :

Post a Comment