Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why do you have to create a directory before you can mount a share to it?

Eg: I've never understood why mkdir is needed here:

mkdir /Volumes/foo
mount -t afp afp:// /Volumes/foo
share|improve this question
up vote 3 down vote accepted

On unix and unix like systems which includes Mac OS X filesystems are laid out logically very different to how they are on Windows. There is no such thing as a drive like C or D etc. There is just a single filesystem which is laid out as a hierarchy (tree structure). This filesystem can be made up of one physical drive or a number of physical drives in a machine. It can also be made up of memory and shares from another machine via protocols like NFS, CIFS etc. Because there is no drives per se you need to have somewhere on the filesystem that you can attach or mount this additional storage to so you create a directory and then mount the other filesystem there.

Linux systems for instance have either a /mnt directory or a /mnt hierarchy with directories like cdrom etc. in it. In this case you do not need to make a directory first you can use one of these but you are not required to as the mount point can be anywhere on the filesystem. This benefit can be really useful if you need more space soemwhere as you can add another drive, move the data onto it and then mount it where the old directory was and everything will keep working without any change.

share|improve this answer
Thanks for spotting that one. Missed it when I checked the message. Post correct. – Sean Preston May 21 '09 at 20:30
allright, killed my comment :) – lImbus May 22 '09 at 13:06

It's because when you mount a directory, you're saying to your system, "Act as though the files at <network share> are really at <local folder>." If the system doesn't have that local folder, it can't place those network files there.

share|improve this answer

Because nobody submitted a patch to add the --create-dir option to mount yet? :)

share|improve this answer
I am very certain that NEXTSTEP's behavior was as your --create-dir option would be. I have spent the last hour searching the internet for evidence either way but alas without success! – Adrian Smith Oct 16 '14 at 19:26

most disturbing is IMHO that creating a link somewhere does NOT need to touch/mkdir, and a mount (even if -bind locally) needs.

But it probably goes in the same section as "why are hard-links the default when everybody only needs symlinks and has to ln -s.

share|improve this answer

The directory entry needs to be created in /volumes (in this particular example) before the kernel can hook into the directory path.

share|improve this answer
Technically that's incorrect. You can mount a filesystem at any place in your hierarchy - it's standard practice to mount it in /Volumes/ (and is auto done by the OS) but there are times when mounting it somewhere specific makes sense. – Chealion May 20 '09 at 18:23
Oh, I only meant /volumes in this specific case. :) Not in general. – MikeyB May 20 '09 at 18:51
That makes more sense. :-) – Chealion May 20 '09 at 19:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.