macos OS X 挂载本地目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1081485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OS X mount local directory
提问by
Is it possible to mount a local directory into another one? Using Perforce, 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.
是否可以将本地目录挂载到另一个目录中?使用 Perforce,我想做一些相当于对目录进行符号链接的事情,但以一种愚弄它的方式让它认为它实际上只是项目中的另一个目录。
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?
这可能吗,如果可以,我需要提供哪些选项?
回答by ennuikiller
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
您只能在目录树下挂载不同的文件系统。您可以通过硬链接目录来实现您想要做的事情。OS X 允许硬链接目录并强制它想要不同的目录
回答by ignis
mount localhost:/path1 /path2
will use NFS.
将使用 NFS。
There is a lot of things that may go wrong with NFS, it would be insane to handle them in this answer, better ask on apple.stackexchange.comand read man mount_nfs(8).
NFS 可能有很多问题,在这个答案中处理它们会很疯狂,最好在apple.stackexchange.com上询问并阅读man mount_nfs(8)。
回答by Dan Walters
回答by David
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.
需要注意的是,从操作系统的角度来看,这两个链接被同等对待。您可以删除/foo/bar
并/home/foo/bar
保留对磁盘上数据的有效引用。