Using mklink on Windows to move data off of SSDs

I have had a solid state drive in my desktop computer at home for quite some time now, and just recently upgraded my machine at work to include one. It’s amazing how much faster your machine runs when you drop in an SSD with twice the read and write speeds of a standard hard drive. But due to the fact that SSDs have yet to come down in price (they’re currently around ~$.95 / gigabyte), getting a large SSD is still too expensive for most of us. What I like to do is buy an SSD with a reasonable amount of space, use it as my boot and programs drive, and then buy a standard 1TB HDD for all of my data. This gets the best of both worlds – size and speed. The only issue I’ve had with this setup is automatically saving data to the data drive. When you want to save to My Documents, for instance, it is stored on your Windows install drive, which in this case is your SSD. You have to manually navigate to your data drive in order to save there. What would be best is to have Windows default the save locations to the data drive – and this is solved by using a combination of relocating your user folders and mklink.

Windows 7 (as well as XP, Vista and probably 8) has a built in way of relocating your user folders, e.g. My Documents, My Music, etc. The benefit of using this feature over creating a second copy of your user folders is that the Windows Environment Variables still work and clicking My Docuemnts in a Save dialog will automatically map to the correct place.

To set this up, right click the My Documents folder, choose Properties and click the Location tab. From there, you can specify the folder you want to act as My Documents:

myDocumentsLocation

Now anytime you click My Documents in Windows Explorer or a Save dialog it will navigate to your My Documents folder on the data drive. That wasn’t too bad, right?

The mklink command in the dos prompt allows you to create a symbolic link to a folder. The beauty of this is that the link acts as a real folder, allowing you to list files, create folders and do everything you can do with a real folder. The data, however, shows up in the folder the link points to. I find this useful when working on projects that need to access the file system – one good example is sending mail. In our development environment, we have the project configured to store the messages on disk rather then send them out using an internal SMTP server. Generally we have them save to C:TempMail, but since I want to store everything on the data drive I set up a symbolic link so that C:TempMail is actually D:Mail.

To create a symbolic link, you open a command prompt and use the mklink command. There are a number of parameters, but the easiest way is to specify the link name and the folder to point to:

C:> mklink /d Temp D:/Temp

The above command will create a link on the C: drive named Temp that points to the folder D:Temp. You can use the link as a real folder, like so:

C:> mkdir TestFolder C:/Temp

The above actually creates D:\Temp\TestFolder!

While speed is great, lack of space is not. Having Windows automatically save data on your data drive is very useful – it cuts down the amount of file organization you have to do yourself and keeps your smaller drives from filling up. If you have an SSD, I highly recommend moving your document folders and any data folders to a data drive.