How Do I Create a Sym Link

rocknblogger

macrumors 68020
Original poster
Apr 2, 2011
2,331
414
New Jersey
I installed a hard drive in lieu of the super drive and I want to move my Pictures, Documents, Downloads, Music and Movies folders to that drive.

And I want to be able to click the corresponding folder in the Finder sidebar to navigate to each of this folders.

I've searched Google but haven't been able to find anything that's easy to understand.

Do you know of a tutorial on how to do this that's written in plain English and easy to follow?

Thanks in advance!!
 

linuxcooldude

macrumors 68020
Mar 1, 2010
2,476
5,125
I installed a hard drive in lieu of the super drive and I want to move my Pictures, Documents, Downloads, Music and Movies folders to that drive.

And I want to be able to click the corresponding folder in the Finder sidebar to navigate to each of this folders.

I've searched Google but haven't been able to find anything that's easy to understand.

Do you know of a tutorial on how to do this that's written in plain English and easy to follow?

Thanks in advance!!
If you use iTunes for your music, I know you can tell iTunes where your music is located in the advanced tab in preferences.
 

tyche

macrumors 6502
Jul 30, 2010
411
61
Well you can just drag the directories on your external drive and put them in your Finder favorites .

To do a sym link the way I think you are talking about. Example your external drive is called '2tb'

open terminal and cd to the directory you want the link made

ln -s /Volumes/2tb/music music

This will create a link called 'music' in this directory that is pointing to the external disk.
 

mobilehaathi

macrumors G3
Aug 19, 2008
9,351
6,219
The Anthropocene
Someone correct me if I'm wrong, but I thought Finder aliases were just symlinks. In which case, you could just right click, create an alias, rename it, and move it into place.
 

Intell

macrumors P6
Jan 24, 2010
18,883
372
Inside
Someone correct me if I'm wrong, but I thought Finder aliases were just symlinks. In which case, you could just right click, create an alias, rename it, and move it into place.
Finder aliases are soft symlinks. Some programs do not or cannot follow them. Symlinks created with the ln command are hard symlinks and are fully able to present themselves as folders or files to everything that requests them.
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
7
Switzerland
Finder aliases are soft symlinks. Some programs do not or cannot follow them. Symlinks created with the ln command are hard symlinks and are fully able to present themselves as folders or files to everything that requests them.
Usually also in the command line one creates soft links, via "ln -s", as mentioned above.

From wikipedia:
To prevent endless recursion, most modern operating systems don't allow hard links on directories. In addition, hard links on directories would lead to inconsistency on parent directory entries. A notable exception to this is Mac OS X v10.5 (Leopard) and newer, which use hard links on directories for the Time Machine backup mechanism only. Symbolic links and NTFS junction points are generally used instead for this purpose.
Hard links can only be created to files on the same volume. If a link to a file on a different volume is needed, it may be created with a symbolic link.
The maximum number of hard links to a single file is limited by the size of the reference counter: with NTFS this is limited to 1023 because a 10 bit field is used for this purpose. On Unix-like systems the counter is usually machine-word-sized (32 or 64-bit: 4294967295 or 18446744073709551615 links, respectively).
 

mobilehaathi

macrumors G3
Aug 19, 2008
9,351
6,219
The Anthropocene
Finder aliases are soft symlinks. Some programs do not or cannot follow them. Symlinks created with the ln command are hard symlinks and are fully able to present themselves as folders or files to everything that requests them.
Right, I meant soft symlinks. Does the OP need a hard link? If all he wants to do is be able to navigate through the Finder...

I guess if he wants certain programs to be able to follow those links then hard is what he wants, and then he'd want to drop the '-s' flag from the suggested command above.
 

Intell

macrumors P6
Jan 24, 2010
18,883
372
Inside
Aliases are not quite symlinks. The ln -s command's soft symlinks are the correct solution to the OP's question, where an alias could cause problems with some programs.
 

mobilehaathi

macrumors G3
Aug 19, 2008
9,351
6,219
The Anthropocene
Aliases are not quite symlinks. The ln -s command's soft symlinks are the correct solution to the OP's question, where an alias could cause problems with some programs.
Ahh, ok i thought an alias was exactly a symlink as created by ln -s. I learned something new today! :D
 

rocknblogger

macrumors 68020
Original poster
Apr 2, 2011
2,331
414
New Jersey
Well you can just drag the directories on your external drive and put them in your Finder favorites .

To do a sym link the way I think you are talking about. Example your external drive is called '2tb'

open terminal and cd to the directory you want the link made

ln -s /Volumes/2tb/music music

This will create a link called 'music' in this directory that is pointing to the external disk.
EDIT: Okay I'm not sure what this did. My goal is to be able to click on the folder icons in the sidebar of Finder and take me to the chosen folder's contents. So if I click the Music folder it takes me to the music folder on the 500GB drive.

Currently Music is stored in the default Music folder but I have a 240GB SSD and I want to move it to the 500GB drive but still have Lion understand that this is the default Music folder.

Same for all the other file folders in the home directory. I hope I made that clearer.
Sorry I can't multi-quote but thanks to everyone.

With this method do I have to create the directories I want and then run that command or by running that command Lion will create the directories I want?

I also remember reading somewhere that it's possible to set up two drives, an SSD and a spin drive, in such a way that Lion will show only a single primary drive and will automatically move files to the bigger drive as needed.

I'm not talking about RAID, I know what RAID is and what it does. Does this sound familiar to anyone?

I wish I had bookmarked that page :(
 
Last edited:

theSeb

macrumors 604
Aug 10, 2010
6,963
83
Poole, England
Finder aliases are soft symlinks. Some programs do not or cannot follow them. Symlinks created with the ln command are hard symlinks and are fully able to present themselves as folders or files to everything that requests them.
Correct, except that the "everything" bit. Unfortunately iTunes is not able to fully follow them.

I've played with the idea of splitting up my iTunes library using symbolic links. I wanted the media info (stuff like album artwork), Books and Mobile Applications to remain on the SSD and then move the individual folders like Music, Movies, iTunesU and TV Shows to the second HDD.

This works for playback, but it goes wonky if you download extra stuff. Basically iTunes won't follow the symlink if you download a movie and the file will not be moved into the correct directory. It will remain in the downloads folder.

Also if you tick "Keep media organised" and then add an item to the library manually, it also won't follow the symlink and stick that item into the correct directory. For some strange reason iTunes uses an odd method in the code to do this that is not compatible with symbolic links. There are plenty of discussions on the net about this, which I only found after trying to do this.

In the end I moved the entire library from the iTunes level to the second HDD and created a symbolic link called iTunes in the home/Music folder.

----------

Ahh, ok i thought an alias was exactly a symlink as created by ln -s. I learned something new today! :D
Apart from what was already mentioned, an alias is a lot larger ( a couple of megabytes vs a couple of kilobytes) and also an alias keeps track of what it is pointing to. So if you're pointing to a file and then you move it or rename it, the alias will continue to work. The symbolic link will no longer work and will need to be recreated to point at the new location.

OP: copy the music folder to your other HDD. Create a symbolic link to it in your home drive called Music. Your sidebar buttons will continue to work because they are actually aliases.

For example: if I move my Documents folder to somewhere else or rename it, the sidebar buttons will still work. But you still need to create a symbolic link to Documents in your home folder to make sure all other applications work as expected. I hope that makes sense.
 
Last edited:

rocknblogger

macrumors 68020
Original poster
Apr 2, 2011
2,331
414
New Jersey
OP: copy the music folder to your other HDD. Create a symbolic link to it in your home drive called Music. Your sidebar buttons will continue to work because they are actually aliases.

For example: if I move my Documents folder to somewhere else or rename it, the sidebar buttons will still work. But you still need to create a symbolic link to Documents in your home folder to make sure all other applications work as expected. I hope that makes sense.
Can you give me a step by step because what I'm doing is not working. I did what tyche suggested and it doesn't work for me. I must be doing something wrong.
 

rocknblogger

macrumors 68020
Original poster
Apr 2, 2011
2,331
414
New Jersey
Do you want to move your entire home directory onto the HDD? I did the same thing when I installed an SSD in place of my superdrive - wrote up instructions here:

http://www.element84.com/replacing-a-macbook-superdrive-with-an-ssd.html

You'll want to scroll down to the "Moving data around" section.

Disclosure: Link to my company's blog - don't want to seem like a spammer.
That seems pretty straightforward. Move Home folder to hard drive, change user's path to point to that hard drive.

This means that the Library directory will also be moved. Wouldn't having the Library on the hard drive impact speed when it comes to certain apps?
 

ppilone

macrumors 6502
Jan 20, 2008
361
0
That seems pretty straightforward. Move Home folder to hard drive, change user's path to point to that hard drive.

This means that the Library directory will also be moved. Wouldn't having the Library on the hard drive impact speed when it comes to certain apps?
Sure, any data saved to Application Support (as an example) would be read off the HDD. I installed a relatively small SSD so all of my data stays on the HDD.

What I suggested does move your entire home folder so it may not be what you need.
 

rocknblogger

macrumors 68020
Original poster
Apr 2, 2011
2,331
414
New Jersey
Sure, any data saved to Application Support (as an example) would be read off the HDD. I installed a relatively small SSD so all of my data stays on the HDD.

What I suggested does move your entire home folder so it may not be what you need.
It's almost what I want. I want to get the most of my SSD so I would rather just move the personal file folders.
 

smurray

macrumors regular
May 12, 2008
131
3
It's almost what I want. I want to get the most of my SSD so I would rather just move the personal file folders.
I'm in the same situation as you. I want to store my media files/folders on an external drive, but am concerned about the Library folder residing there as well. I'm more concerned about what would happen if I were to ever reinstall Lion, since after I moved the home folder again there would be my old Library folder with all the settings from my previous install.
 

diamond3

macrumors 6502a
Oct 6, 2005
832
257
Has anyone tried this? I'm currently in the process of figuring this out but am not sure.

I've got the SSD and a HDD in my mbp. I tried to create a sym link with the downloads folder first. Here are my steps

Copy Downloads folder from SSD to HDD
Does file structure matter? ex. On SSD: SSD/users/username/Downloads/ to just /HDD/Downloads?​

After that, I opened terminal and pasted
Code:
sudo rm -rf ~/Downloads/
entered password, which deleted folder on SSD

Pasted the following into terminal
Code:
ln -s /Volumes/HDD/Downloads/ ~/Downloads
I lose the downloads folder in the sidebar and my folder on my HDD doesn't have the normal download folder icon. This does create a symlink though in my username folder on the SSD so I thought it would work.

So then I tested it by downloading a file from safari, but it defaults now to the desktop. I know I can change the path location in safari, but I thought that was the whole point of creating a sym link?

Any help would be appreciated.
 

rivervillager

macrumors newbie
Sep 14, 2012
1
0
SSD+HDD and creation of symlinks

Hi diamond3 - did you find a solution? I am having same problem: symlink works when I click on downloads folder, but when I download something it is directed to my desktop. I only want to transfer downloads, images, documents and other potentially large but infrequently accessed files to the HDD, which was placed in the opti-bay. I did a complete new install, and am running Mountain Lion on a pre-unibody 2008 MBP.
 

CASLondon

macrumors 6502a
Apr 18, 2011
536
0
London
Hi diamond3 - did you find a solution? I am having same problem: symlink works when I click on downloads folder, but when I download something it is directed to my desktop. I only want to transfer downloads, images, documents and other potentially large but infrequently accessed files to the HDD, which was placed in the opti-bay. I did a complete new install, and am running Mountain Lion on a pre-unibody 2008 MBP.
I'm finding myself in the same boat, standing a little confused. I want to do the same, keep Home on the SSD but move downloads, pictures, movies, music folders to the HDD and symlinks from SSD.

Here are the references I've found

http://mattgemmell.com/2011/06/21/using-os-x-with-an-ssd-plus-hdd-setup/

I've used the symlink services download successfully, but I seem to have some permissions issues, or something. Its not as simple as it seemed. I can't delete the original special folders without a warning that OS needs them.

Now I log in as a root user and start again. I can indeed delete via terminal the original downloads folder, put a new folder called downloads on the HDD, symlink it, move that symlink to the right spot on the original folder structure under users. All looks right, but then OS X seems to recreate a new "special" downloads folder ALONGSIDE my new symlink one.

Anyone want to lay out the "For Dummies" version of moving Downloads, Pics, Etc to HDD and using symlinks?
 
Last edited:

pukrnukr

macrumors member
Dec 16, 2010
95
20
Roc
I've used the symlink services download successfully, but I seem to have some permissions issues, or something. Its not as simple as it seemed. I can't delete the original special folders without a warning that OS needs them.

Now I log in as a root user and start again. I can indeed delete via terminal the original downloads folder, put a new folder called downloads on the HDD, symlink it, move that symlink to the right spot on the original folder structure under users. All looks right, but then OS X seems to recreate a new "special" downloads folder ALONGSIDE my new symlink one.

Anyone want to lay out the "For Dummies" version of moving Downloads, Pics, Etc to HDD and using symlinks?
I know this is old but did you ever figure this out? I still can't delete the original downloads folder even though I'm logged in as the admin and root user.