Where exactly are symbolic links stored

Hello


I set up some symbolic links to folders which are not in the root of the main boot drive. Can I "see" where they are located?


Thanks in advance


Hans

iMac (27-inch Mid 2010), OS X Yosemite (10.10.2)

Posted on Mar 22, 2015 5:05 AM

Reply
14 replies

Mar 23, 2015 5:45 AM in response to hanyvo

I have done this process with two computers, but they are linux computers, not Macs. (I got the idea from Mac sources)

Here's what I recommend. The idea is Not to move your home folder, but move the data folders within it, to the second drive. This preserves the speed advantage of an SSD, by keeping heavily-used preferences, caches and Library files, in your home folder on the SSD. I guess you have a new, complete OS X install on the SSD now?

1) You need a current backup of everything. Now! In addition to the older Time Machine backup you can use to restore all apps.

2) Go to the Terminal. When you open Terminal, you will be in your home folder. confirm by typing command pwd (present working directory)

mine says: /Users/greg

Confirm you know the correct path name to the second drive. Try command df (disk-space free).

Example entry for the second drive-external on my Mac:

/dev/disk1s2 xxspace_totalxx xxspace_usedxx xxspace_availxx %used xxxx xxxx %used /Volumes/Green1TB

So, /Volumes/Green1TB is my second drive. If I already have a home folder there, the path to the folders would be /Volumes/Green1TB/Users/greg/Documents, etc.

3) Here are the folders on the second drive that I'd link to:

Documents

Downloads

Movies

Music

Pictures

Public (maybe - it's your choice - I don't use this for file sharing & wouldn't link it)


4) copy any new files in these original folders (now on the SSD) to the folders on the second hard drive.

5) One by one, delete your data folders on the new SSD, and create a link to the matching folders on the Second (old) hard drive.

Commands:

sudo rm -Rf Documents


sudo ln -s /Volumes/Green1TB/Users/greg/Documents Documents


Now, go to the second folder (Downloads, for example) and do the same two commands for that. and so on.

Afterwards, you will need to tell applications like iTunes, iPhoto and iMovie where their libraries of files are stored.


Here are some other references:

http://www.engadget.com/2012/01/20/ask-tuaw-how-do-i-setup-a-mac-with-both-an-ss d-and-a-regular-hd/

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

Mar 22, 2015 6:35 AM in response to hanyvo

If you set up links at the root level, surely you know that the root level of the drive is / in the Terminal?

Sounds a little dangerous, doesn't it - a novice blindly doing some "ln -s" commands without understanding the outcome!!!

In the Terminal, change directory to / like this

cd /

to list everything, do

ls -al


Sorry for the lecture - does this answer your question?


If not, you'd better include the actual commands or a link to where you found them.

Mar 22, 2015 1:09 PM in response to greg sahli

Thanks a lot Greg for your answer and concern about a "novice tumbling head over heels in the Terminal black hole". And of course I know what the outcome of a ln -s command will be, and in the last couple of weeks did some study and practice. I have 2 "hardware" sources: 1. Macintosh Terminal Pocket Guide - D. Barrett (O'Reilly, 2012) and 2. Mac OS X Unix Toolbox; 1000+ Commands for Mac OS X Unix - Thomas Myer, Christopher Negus and Francois Caen. These books are in the usual bookstores now. The 3rd source is the Internet of course. So, I certainly do not have the expertise you already acquired but also not a real novice anymore I hope:) I do my best to make some progress, and no, I don't feel offended at all for your lecture. Your explanation, unfortunately, didn't answer my question. In my Windows-age I made a shortcut with a mouse right-click, Windows generated the shortcut depicted as a file and you can drag this "thing" to the desktop (or where ever you needed it) and you can see it sitting there where you dropped it. I was looking for the analogy in OS X: the link must be saved somewhere in some form. Maybe there is no analogy, then that's ok for me as well. If you have experience with symbolic links than maybe you can help me further?

I will take NO also as an answer, Greg.

Hans

Mar 22, 2015 2:28 PM in response to hanyvo

Hans -

I "think" I understand now. Yes, OS X is a unix-based operating system. But, you don't have to use the Terminal for most tasks. And, the things you do in the Terminal are often not clearly related to the way you do things in the graphical environment of the Finder. (I guess this is like a command line window on Windows)


Since you spoke of making a shortcut, what I think you really want to do in the graphical OS X world is called "making an alias." The alias is analogous to making a shortcut in Windows. Right-click (or hold command & click) on the file/app/document you want to have a movable alias of, and you will see a contextual menu with "make alias" as a choice. OS X puts the alias right there next to the item you wanted an alias of. Drag the alias wherever you want.


Does answer the question?

Mar 22, 2015 4:02 PM in response to greg sahli

I like to explain what my goal is, Greg. I upgraded my iMac with an SSD and left the harddisk as well. I did a clean install of Yosemite, and a new account and Home Folder. Now I am stuck in the middle with a blazing fast computer (it really is). My old Home Folder still resides on the harddisk and so does all my Applications and Library files and directories. I don't want to reinstall all my applications, because I'm not sure about the settings and profiles, not to mention the passwords of (most of) the Applications.


-Do I need to change the permissions of my (old) account's home folder to the new account on the ssd so that OS X "knows" that my (new) account (identity) is entitled to read, write and execute files? (I have read something about permissions, but made a note that I don't fully understand this mechanism). How do I do that -what commands - within Terminal?

-After the exchange of permissions, do I have to delete my home folder on the SSD (I know how to delete directories and files: sudo rm -rf /Users/<dir,file> and then create a symbolic link to the (old) home folder on the harddisk? How do I do that -what commands - within Terminal?


I prefer to use symbolic links because they work with all Macintosh applications, including the shell. An alias work only in Finder, so when an alias points to a folder, Finder will open that folder. But it is not possible to cd an alias from the shell, cd does follow symbolic links. I'm not sure what an application does with an alias.


So, if you can be of any help for me I would much appreciate it

Because of the time difference it may take some hours before I can answer you.

Hans

Mar 22, 2015 9:29 PM in response to hanyvo

Thanks for making it clearer.

I'm working on a tutorial for you - but I want to know if you used the same username on your new SSD? If not the permissions problem will be worse.

I Strongly recommend you put all your applications on the SSD - so you have the speed benefit of an SSD. An easy way to do this is by using Time Machine for your backup and restoring from there to the SSD.

Mar 23, 2015 7:35 AM in response to greg sahli

You went to bed to sleep last night, didn't you? That's a lot of information to chew on, Greg, and it will take some hours for me to digest it for sure because english is not my native language (I'm from The Netherlands).


(quote:)"The idea is Not to move your home folder, but move the data folders within it, to the second drive. This preserves the speed advantage of an SSD, by keeping heavily-used preferences, caches and Library files, in your home folder on the SSD..."


As I mentioned before: I left my old Home folder on the harddisk, all my data is sitting there patiently waiting for your help:). The ssd is only occupied by a clean Yosemite installation. So that changes the scenario to


1. copy the Library and Application Folders to the ssd

2. Remove the Datafolder on the SSD-as you mentioned above-

3. Create the symbolic link to the Data Folder just removed

4. Repeat for every Folder (as mentioned)


Questions:

1.Do I have to remove folders/files first before I can create the symbolic links?

2. The syntax of the ln -s command is ln [options] source target. My problem with this is what is meant with the source and what is the target. In my "view" the source is the real data file and the target is the pointer /vector, pointing to the other location. Please correct me if I'm wrong!

3. In your example ..."sudo ln -s /Volumes/Green1TB/Users/greg/Documents Documents..." you specify the full path of the (source) Folder Documents but not the path to the target.


Can you explain?


Hans

Mar 23, 2015 9:16 AM in response to hanyvo

1) Yes, you must remove the folder before creating the link, because the link must have exactly the same name, and be in exactly the same original location.

2) We are using the ln -s form of the command.

Here's what it means:

ln -s source target (source is on old drive; target is the new link on the SSD in place of the original folder we deleted. I don't like this terminology, because it is a different use of the word "target" on BSD unix in OS X, than on linux, but I just tested it and it works as I've explained.)

3) Whenever you don't specify the whole path, you are telling Terminal to use "in the present working directory" - which is /Users/<username>. So you will create the link named Documents in /Users/<username>. It is the same as completely specifying /Users/greg/Documents. (maybe this one thing is what your original question was about?)

Mar 23, 2015 9:53 AM in response to greg sahli

..." maybe this one thing is what your original question was about..."

YESS. You got it: my confusion how source and target are defined here but because you tested it I can rely on the other definition.

Once again -but certainly not enough said- thanks a lot for your time and patience to help me with this lecture.

When everything works the way I expected I will mark these as "this helped me".


Hans

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Where exactly are symbolic links stored

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.