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. js实现随机数及随机数组

    js数组元素的随机调用 工作中网页填充数据时需要一个短语库,来拼接在短语句子后边.那就写一个js吧,放在input的keydown或keyup里边用喽. 贴代码: <SCRIPT LANGUAG ...

  2. Spark学习笔记0——简单了解和技术架构

    目录 Spark学习笔记0--简单了解和技术架构 什么是Spark 技术架构和软件栈 Spark Core Spark SQL Spark Streaming MLlib GraphX 集群管理器 受 ...

  3. CF1210A Anadi and Domino

    思路: 很有意思的思维题. 实现: #include <bits/stdc++.h> using namespace std; int check(vector<int>&am ...

  4. 高级UI-NavigationView侧滑

    NavigationView是遵循MD设计规范的侧滑模式,推荐使用 要使用NavigationView,就需要引入support-design依赖 implementation 'com.androi ...

  5. java中创建线程的方式

    创建线程的方式: 继承thread 实现runnable 线程池 FurureTask/Callable 第一种:继承thread demo1: public class demo1 { public ...

  6. redis的主从复制和哨兵模式

    Redis主从复制是什么? 行话:也就是我们所说的主从复制,主机数据更新后根据配置和策略, 自动同步到备机的master/slaver机制,Master以写为主,Slave以读为主 Redis主从复制 ...

  7. [转帖]超详细的EXPDP、IMPDP规范及常用技巧总结

    超详细的EXPDP.IMPDP规范及常用技巧总结 https://www.toutiao.com/i6727232212850180619/ 原创 波波说运维 2019-08-24 00:06:00 ...

  8. Xamarin.Forms FlyoutIcon 不显示(not shown)

    升级了VS2019到16.4版本,然后默认创建了一个Xamarin Shell程序 结果运行后是这个样子 难道不应该是这个样子吗? 百了个度一晚上没解决,资料本身就少,再就是提示设置FlyoutIco ...

  9. Docker下搭建mongodb副本集

    背景 有需求需要对mongodb做一个容灾备份.根据官网,发现mongodb最新版本(4.0)已经抛弃了主从模式而采用副本集进行容灾.副本集的优势在于:"有自动故障转移和恢复特性,其任意节点 ...

  10. C++Primer 5th Chap9 Sequential Container

    vector 可变大小数组,支持快速随机访问(在除了尾部之外部分插入删除元素很慢) deque 双端队列,支持快速随机访问(在头尾插入删除元素很快) list 双向链表,仅支持双向顺序访问(在任何位置 ...