tags:

views:

1472

answers:

6

is it possible to mount a local directory into another one. Using perfoce I want to do something equivalent to symlinking a directory, but in a way that fools it into thinking it's really just another directory in the project.

I would like to do something like:

mount /foo/bar /home/foo/bar

Is this possible, and if so what options do I need to give it.

A: 

You can only mount different filesystems under the directory tree. You may be able to achieve what you're looking to do by hard linking the directories. OS X allows hard linking directories and to perforce it would like like different directories

ennuikiller
A: 

To make a hard link from one directory to another, run:

$ ln /foo/bar /home/foo/bar

It is important to note that from the OS's perspective, both links are treated equally. You can delete /foo/bar and /home/foo/bar will remain a valid reference to the data on disk.

David
Hardlinking directories is evil!!! (Unless you're very careful...)
Stobor
you can _not_ hardlink directories in OSX via 'ln'
Steve918
Whoops. Shame on me for not actually running the command. Point taken.
David
Time Machine actually uses hard links to directories, so it must somehow be possible.
biocs
It can be done, but you have to write code to do it... Some example code (as well as the conditions placed on directory hard links) is about halfway down on this page: http://www.osxbook.com/blog/2008/11/09/hfsdebug-40-and-new-hfs-features/ (search for the word "experimentation")
Stobor
+4  A: 

bindfs seems like what you're after...

Stobor
A: 

mount --bind /foo/bar /foo/baz works on linux at least, so unless OSX doesn't allow this syntax (haven't got a mac to try on), or you need the extra features of bindfs, don't over-complicate ;)

carlpett
I don't own a mac, but checked http://www.google.com/search?q=osx+man+mount before proposing bindfs. :)
Stobor
Sigh. My google-fu is weak it seems. Anyway, why did they leave that out?
carlpett
--bind is a Linux extension. Mac OS X: mount: illegal option -- -
mark4o
+1  A: 

--bind wont work

A: 

The BSD (and thus Darwin/OSX) method of achieving this is nullfs. It's not in a standard build of OSX, but perhaps it's possible to build from source if you have the time to play around with it.

hannibal