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. centos6.8下配置vsftp

    几个小时的调试 终于OK了 以下配置就算开了selinux 也照样能正常上传 注意 默认的上传目录 在 /home/用户名目录 如果不能下载文件 设置下文件的权限 一.安装VSFTP # yum -y ...

  2. 为什么要用k8s

    经过几次面试,发现有的公司没有用过k8s,有的公司正在用,但是都问了共同的问题:k8s的好处在哪里.所以总结了一下几点 1.故障迁移:当某一个node节点关机或挂掉后,node节点上的服务会自动转移到 ...

  3. LODOP中纸张高度不定超文本和纯文本对比

    关于纸张高度不定的小票打印,建议使用纯文本进行设计,避免纸张高度引起变形,或超文本解析差异造成一些影响:LODOP纸张高度不定的纯文本累计高度 上面的链接的博文里,纯文本可通过间距和高度值累计,得出最 ...

  4. 【leetcode_easy】581. Shortest Unsorted Continuous Subarray

    problem 581. Shortest Unsorted Continuous Subarray 题意:感觉题意理解的不是非常明白. solution1: 使用一个辅助数组,新建一个跟原数组一模一 ...

  5. 酒店移动端入住离店日期选择demo(转)

    原作者:http://blog.csdn.net/cj14227/article/details/65629737 效果图: demo 代码: <!DOCTYPE html> <ht ...

  6. java根据模板生成pdf

    原文链接:https://www.cnblogs.com/wangpeng00700/p/8418594.html 在网上看了一些Java生成pdf文件的,写的有点乱,有的不支持写入中文字体,有的不支 ...

  7. 并行forearch的使用及测试(Parallel.Foreach)

    using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tas ...

  8. JVM -- 对象的概述和引用

    一.概述 说起垃圾收集(Garbage Collection,GC),大部分人都把这项技术当做java语言的伴生产物,然后GC出现历史比java久远. GC需要完成的3件事情: 1.哪些内存需要回收 ...

  9. STL标准模板库之vector

    目录 vector容器 1)什么是vector 2)如何定义 3)常用的Vector函数 1.容量函数 2.增加函数 3.删除函数 4.迭代器 5.访问函数 6.其他函数及操作 7.算法 STL提供了 ...

  10. python并发编程之IO模型(实践篇)

    一.阻塞IO 介绍略(请看概念篇) 二.非阻塞IO 在非阻塞式IO中,用户进程需要不断的主动询问kernel数据准备好了没有 # 服务端 import socket import time serve ...