Difference between MKLINK /D and /J (Symbolic link and junction)

mklink

I have a SSD, and a RamDisk in other disc drive.
I use MKLINK /D to move Google Chrome cache, from my SSD to my RamDisk.
Please, my questions are:

  1. With MKLINK /D, where physically is my cache? SSD? RamDisk? Both? Am I moving cache to my RamDisk? Or just duplicating cache on my SSD and RamDisk? I ask because the same files and folders appear in both drives (SSD and RamDisk).

  2. Does MKLINK /D work with files, folders and sub-folders? Only one MKLINK /D is enough for every file, folder and sub-folder under this symlink? Files, folders and sub-folders are physically going to be in the SSD or RamDisk?

  3. Should I use MKLINK /J? In my case, what's the technical difference using MKLINK /D or MKLINK /J?

Thanks!

PS1: I already googled the issue, but is very confuse.

PS2: I am not interested in the –disk-cache-dir="x:" solution.

Best Answer

If you run mklink /? you will get the information that it's used to create a symbolic link. While the /J switch would make it a junction instead of a link. For a view of the differences you could check the question What is the difference between NTFS Junction Points and Symbolic Links? or the information on Wikipedia.

In both cases the files would not exist at two points at once but rather you would be redirected to the other point by accessing one of them. So by setting up a symbolic link for a directory you would merely access another location. As such the cache remains only on your target (your RAM disk).

An easy example:

mkdir target
mklink /D linkname target
echo "This is a test" > linkname/test.txt
rmdir linkname
dir target

The result will be a file named test.txt in your target folder while there isn't a link to it anymore. So a cd linkname would fail.

Related Question