Glam Prestige Journal

Bright entertainment trends with youth appeal.

I just started using Mac OS X. Under the root directory /, there is a folder named Volumes/.

When I go under the directory Volumes/, there is a directory named Macintosh HD/. When I go under the directory Macintosh HD/, I come back to the root and I can go under the Volumes/ directory again. If I keep on doing this a few times and check the directory I am at by using pwd, I see that I am in a directory named /Volumes/Macintosh/Volumes/Macintosh/Volumes/Macintosh.

I am not able to understand the logic behind this. Can someone explain?

1 Answer

First, just understand that the /Volumes/ directory is where all mounted volumes on your Mac OS X system naturally show up. And the reason you see that behavior happen is because Macintosh/ is just a symbolic link to / (root) on your system; that is done in /Volumes so you still have named access to that volume in addition to the / (root) access to that volume.

For example, if you went into the Terminal on your system, typed cd /Volumes and then typed in ls -la you might see something that looks like this:

drwxrwxrwt@ 7 root admin 238 Sep 13 23:55 .
drwxr-xr-x 29 root wheel 1054 Sep 13 01:43 ..
lrwxr-xr-x 1 root admin 1 Sep 13 16:42 Macintosh -> /

A symbolic link is basically like an alias in the Finder; but on a file system level a symbolic link is what an “alias” is.

As for why you see it do that /Volumes/Macintosh/Volumes/Macintosh/Volumes/Macintosh in pwd that’s just the file system interpreting your path. Yes, it can seem weird and confusing but don’t be confused. The only mounted volume under /Volumes/ that behaves that way is the root (/) volume of your system. If you mount any other volumes, they will show up in /Volumes/ and will not loop like that since they will be actual, mounted volumes and not symbolic links.

Now as for the “why” of that nested symbolic link/directory behavior, that is not an easy question to answer. But basically all Linux/Unix systems behave like that. And this question and answer thread on the Unix & Linux Stack Exchange does go into some extreme detail as to why you nested directories caused by symbolic links exist.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy