First ,Symlinks and bind mounts are a whole different ballgame.

ln -s you create a symbolic link,which is an inode pointing to a certain filesystem object.

If you mount a filesystem with --bind, you create a second mountpoint for a device or filesystem.

If you envision a symlink as a redirect, then envision a --bind mounted filesystem as creating another gateway to data.

The --bind mount seems a bit more robust to me and it probably is a bit faster than working with a symlink.

a symlink is visible in an ls,whereas a bind mount is only visible when looking at /proc/mounts or /etc/mtab (which is what the mount command does, if it is executed without parameters).

 

One of the big differences between ln -s and a bind mount is that you can use a bind mount to "modify" a read-only filesystem.

For example, if there were a CD mounted on /mnt/application, and you wanted to replace /mnt/application/badconfigfile.conf with a correct version, you could do this:

mount -o bind /path/to/correct/file.conf /mnt/application/badconfigfile.conf

It would not be possible to affect the same change using a symlink because you're not able to modify the target filesystem. This can also be used to good affect if you distributed a common suite of software via NFS (or some sort of cluster filesystem), and you want to make host-specific changes on one system. You can simply use a bind mount on the target system to override the files or directories as necessary.

 

Practial difference #1 for me between ln -s and mount --bind :

vsftpd doesn't not allow to browse a directory through a symbolic link, but allows when mounted

 

One might note that as a consequence of binding to a mount, which is itself a binding, that is later rebound, the original binding remains intact, assuming everything physically stay connected.

That is, if bind A to B and bind B to C, and then bind D to B, C will still be bound to A. That might be what you want, or not. If one desires C to follow B then remount using the same targets, i.e. mount -o remount B C, or use --rbind instead. There is no --rebind option.

 

 

 

mount, when invoked without any arguments, prints the contents of /etc/mtab, which has slightly different information than /proc/mounts. (In particular, /proc/mounts (symlink to /proc/self/mounts) always shows the mountpoints visible to the process reading it.) –

ln -s vs mount --bind的更多相关文章

  1. mount --bind 重启后失效的解决办法

    vsftp不支持软链接,可以用mount来支持不同的目录结构 mount --bind /home/www/web/ROOT/img/upload /ftp/private/upload 重启后失效. ...

  2. mount --bind使用方法

    我们可以通过mount --bind命令来将两个目录连接起来,mount --bind命令是将前一个目录挂载到后一个目录上,所有对后一个目录的访问其实都是对前一个目录的访问,如下所示: ## test ...

  3. mount --bind 的妙用

      在固件开发过程中常常遇到这样的情况:为测试某个新功能,必需修改某个系统文件.而这个文件在只读文件系统上(总不能为一个小小的测试就重刷固件吧),或者是虽然文件可写,但是自己对这个改动没有把握,不愿意 ...

  4. mount --bind

    [root@iZwz9i55e7v33yn8ksnh8nZ ~]# mkdir /tmp/dir1 [root@iZwz9i55e7v33yn8ksnh8nZ ~]# mkdir /tmp/dir2 ...

  5. mount --bind绑定命令

    将目录或文件DirFile-1绑定到目录或文件DirFile-2上,所有对DirFile-2的访问就是对DirFile-1的访问 mount --bind [DirFile-1] [DirFile-2 ...

  6. 查看一个目录是否已经mount --bind

    执行 mountpoint -q /test/mount echo $? 如果是0表示已经mount mountpoint -q /test/mount || mount -o bind /some/ ...

  7. Data Volume 之 bind mount - 每天5分钟玩转 Docker 容器技术(39)

    storage driver 和 data volume 是容器存放数据的两种方式,上一节我们学习了 storage driver,本节开始讨论 Data Volume. Data Volume 本质 ...

  8. 37-Data Volume 之 bind mount

    storage driver 和 data volume 是容器存放数据的两种方式,上一节我们学习了 storage driver,本节开始讨论 Data Volume. Data Volume 本质 ...

  9. Bind Mounts and File System Mount Order

         When you use the bind option of the mount command, you must be sure that the file systems are m ...

随机推荐

  1. oracle数据库死锁原因及分析

    定义: 当两个用户希望持有对方的资源时就会发生死锁. 即两个用户互相等待对方释放资源时,oracle认定为产生了死锁,在这种情况下,将以牺牲一个用户作为代价,另一个用户继续执行,牺牲的用户的事务将回滚 ...

  2. 【Leetcode_easy】747. Largest Number At Least Twice of Others

    problem 747. Largest Number At Least Twice of Others 题意: solution1: class Solution { public: int dom ...

  3. maven项目创建.m2文件夹

    创建为.m2.,m2前后都要有点,然后去掉后面的点 settings.xml文件如下: <?xml version="1.0" encoding="UTF-8&qu ...

  4. 案例一:利于Python调用JSON对象来实现对XENA流量测试仪的灵活发包测试,能够适应Pair,Rotate,1-to-Many等多种拓扑模型

    硬件:XENA Valkyrie 或 Vantage主机,测试板卡不限,本方法适用于其100M~400G所有速率端口 环境配置:Python 3 实现功能: 1.控制流量仪进行流量测试,预定配置的流量 ...

  5. Linux系统终端常用配置文件更改

    目录列表: 1.alias别名永久保存 2.解决vim文件没有颜色的问题 3.vim插件supertap插件安装(可支持自动补全,非函数代码补全,仅支持在当前编辑文档内补全) 4.vim插件管理 5. ...

  6. rewrite定义浏览器请求

    搞过前端的估计都碰到最头疼的问题就是浏览器兼容性问题了,特别是针对IE浏览器.往往前端为了省事就搞一个页面提示用户升级浏览器或者显示简单的静态页面.那接下来就需要运维来配置nginx rewrite规 ...

  7. Scala调用Kafka的生产者和消费者Demo,以及一些配置参数整理

    kafka简介 Kafka是apache开源的一款用Scala编写的消息队列中间件,具有高吞吐量,低延时等特性. Kafka对消息保存时根据Topic进行归类,发送消息者称为Producer,消息接受 ...

  8. 某 游戏公司 php 面试题

    1.实现未知宽高元素的水平垂直居中,至少两种方法. <div, class="father"> <div class="son">< ...

  9. Linux (x86) Exploit 开发系列教程之二(整数溢出)

    (1)漏洞代码 //vuln.c #include <stdio.h> #include <string.h> #include <stdlib.h> void s ...

  10. 100天搞定机器学习|Day3多元线性回归

    前情回顾 [第二天100天搞定机器学习|Day2简单线性回归分析][1],我们学习了简单线性回归分析,这个模型非常简单,很容易理解.实现方式是sklearn中的LinearRegression,我们也 ...