如何使符号链接与远程安装一起使用?
我有两台服务器,A 和 B
A 有两个文件系统,/alpha 和 /beta
我有一个符号链接:
ln -s /alpha/foo /beta/bar
这样:
lrwxrwxrwx 1 root root 70 Dec 22 13:32 /beta/bar -> /alpha/foo
接下来,我通过 NFS 安装远程在 B 上安装 /beta
该链接不再有效。
有没有办法实现这一点。我希望能够访问服务器 B 上的 A:/alpha/foo,但我希望能够通过 /beta/bar 符号链接来实现。
我需要修改我的安装或链接吗?或者我正在尝试实现不可能的事情?
更新
我应该添加:“无需将 /alpha 安装到服务器 B”。 简而言之,我希望每当服务器 B 访问 /beta/bar 时,符号链接都会被跟踪到有问题的实际文件
I have two servers, A and B
A has two filesystems, /alpha and /beta
I have a symbolic link:
ln -s /alpha/foo /beta/bar
Such that:
lrwxrwxrwx 1 root root 70 Dec 22 13:32 /beta/bar -> /alpha/foo
Next, I mount /beta, remotely on B via an NFS mount
The link no longer works.
Is there a way to achieve this. I'd like to be able to access A:/alpha/foo on server B, but I want to be able to do it via the /beta/bar symbolic link.
Do I need to modify my mount, or my link? Or am I trying to achieve the impossible?
UPDATE
I should have added: 'without mounting /alpha to server B'.
In short, I would like the symbolic link to be followed to the actual file in question whenever server B accesses /beta/bar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
软链接仅包含本地计算机上另一个文件的路径。您不能引用本地文件系统上不可访问的文件。
选项:
Soft links only contain a path to another file on the local machine. You cannot reference a file that is not accessible on the local filesystem(s).
Options:
该链接正确指向
/alpha/foo
,但您的计算机上不存在该链接。如果您挂载/alpha
,该链接将起作用。The link correctly points to
/alpha/foo
, but that doesn't exist on your machine. If you mount/alpha
, the link will work.您也许可以使用 sshfs 实用程序来执行您想要执行的操作。这将允许您在本地计算机上的远程计算机上安装文件系统。以下是如何执行此操作的参考:
https:// /www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh
You might be able to use the sshfs utility to do what you want to do. This will let you mount a filesystem on a remote computer, on your local one. Here's a reference to how to do this:
https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh
软符号链接的内容是路径字符串,它不知道有关如何挂载文件系统的任何信息。在您的情况下,您可以使用 A 的示例路径在 B 上挂载 /alpha 和 /beta。但强烈建议不要在网络系统之间交叉链接,这很难维护。
soft symbol link's content is a path string, it doesn't know anything about how you mount filesystems. In your case, you can mount /alpha and /beta on B with sample path of A. But strongly suggest don't cross link between network system, that's hard to maintain.
您需要在计算机中安装
/alpha
才能使链接正常工作。You will need to mount
/alpha
in your machine in order to have the link to work.听起来你真正想要的是硬链接。它是指向文件系统中相同数据的另一个指针,因此要真正删除该文件并释放磁盘空间,您必须删除指向它的所有硬链接。
一些脚本和工具可能会被它们混淆。
sounds like what you really want is a hard link. its another pointer to the same data in the filesystem, so to really delete that file and free up that disk space, you have to delete all hard links to it.
some scripts and tools can get confused by them.