Sunday, July 24, 2011

Creating a Symbolic Link

This walkthrough was a little bit complicated for yesterday's SSD setup guide, so I made a separate post for this specifically. If you are running a computer with an SSD and an HDD, obviously you want to keep the larger files on the HDD. However, certain files and folders are needed by applications so that they can run properly. You can't just simply move those folders because then the application won't run properly. Certain apps such as Steam, iTunes, even iPhoto, all store information in your home directory. This is fine on an HDD, but on an SSD where you have minimal space this is not ok. So, how do we move these files? We have to create what is called a Symbolic Link. What this will do is make the OS "think" the files are in the right place, when really you are directing it to the HDD instead of the SSD. This does use terminal, so if you are not comfortable with using terminal I suggest you get comfortable soon, or deal with the space issue you have another way.
1. Find the folder you would like to move. I am going to use my iTunes Music folder located in /User/*insert your username here*/Music/iTunes

2. Copy that folder that you have chosen anywhere you want on your HDD

3. When you are done copying, open up terminal. We want to delete the previous folder, so type:
cd /User/*insert your username here*/Music/iTunes
That will make sure terminal knows what folder we are in. Next type:
sudo rm -rf iTunes Music
It will ask you for your password, and then it will delete your iTunes Music folder from your SSD.

4.Now we have to create the Symbolic Link. Before moving forward, make sure terminal is still in the folder iTunes since that is where we are making the link. If you are doing this for something else, just make sure that you are in the folder that the original file (the one we just deleted) was in. Here is the difference between being in a folder and not being in a folder in terminal:
Notice one says desktop and the other doesn't.
Now, while in the folder type the following into terminal to create the Symbolic Link:
ln -s /Volumes/*Name of hard drive you moved the file to*/path/to/the/file
For me, I would type ln -s /Volumes/Applications/iTunes Music
All we are doing here is telling the computer to make a redirect folder pointing to where we moved the folder to.

If everything went as planned, then you should have something that looks like this:
Notice the folder with the arrow. That is a symbolic link
So go ahead, and give it a try. Best of luck to those you want to do this. Took me a couple of tries to get it right.


No comments:

Post a Comment