ln -s vs mount --bind
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的更多相关文章
- mount --bind 重启后失效的解决办法
vsftp不支持软链接,可以用mount来支持不同的目录结构 mount --bind /home/www/web/ROOT/img/upload /ftp/private/upload 重启后失效. ...
- mount --bind使用方法
我们可以通过mount --bind命令来将两个目录连接起来,mount --bind命令是将前一个目录挂载到后一个目录上,所有对后一个目录的访问其实都是对前一个目录的访问,如下所示: ## test ...
- mount --bind 的妙用
在固件开发过程中常常遇到这样的情况:为测试某个新功能,必需修改某个系统文件.而这个文件在只读文件系统上(总不能为一个小小的测试就重刷固件吧),或者是虽然文件可写,但是自己对这个改动没有把握,不愿意 ...
- mount --bind
[root@iZwz9i55e7v33yn8ksnh8nZ ~]# mkdir /tmp/dir1 [root@iZwz9i55e7v33yn8ksnh8nZ ~]# mkdir /tmp/dir2 ...
- mount --bind绑定命令
将目录或文件DirFile-1绑定到目录或文件DirFile-2上,所有对DirFile-2的访问就是对DirFile-1的访问 mount --bind [DirFile-1] [DirFile-2 ...
- 查看一个目录是否已经mount --bind
执行 mountpoint -q /test/mount echo $? 如果是0表示已经mount mountpoint -q /test/mount || mount -o bind /some/ ...
- Data Volume 之 bind mount - 每天5分钟玩转 Docker 容器技术(39)
storage driver 和 data volume 是容器存放数据的两种方式,上一节我们学习了 storage driver,本节开始讨论 Data Volume. Data Volume 本质 ...
- 37-Data Volume 之 bind mount
storage driver 和 data volume 是容器存放数据的两种方式,上一节我们学习了 storage driver,本节开始讨论 Data Volume. Data Volume 本质 ...
- 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 ...
随机推荐
- scala的wordcount
import org.apache.spark.{SparkConf, SparkContext} import org.apache.spark.sql.SparkSession object Wo ...
- jQuery动态创建html元素的常用方法汇总
在使用jQuery进行WEB程序设计的时候非常有用.分享给大家供大家参考.具体方法如下: 一般来说,可以通过以下几种方式动态创建html元素: 1.使用jQuery创建元素的语法 2.把动态内容存放到 ...
- Fakes里的stub和shim的区别
stub常用于虚拟接口.类.方法,无法重写静态方法(stub需要传递到具体调用代码中) shim常用于重写静态方法(在ShimsContext.Create()作用域内,拦截Runtime动态修改方法 ...
- 在Electron运行的子页面无法访问window.opener解决方案
我们的首页有一个window.open打开子页面后反向刷新父页面的功能,但是主页面如果开启了nodeIntegration=true,这个时候再设置nativeWindowOpen是不启作用的.再被w ...
- java根据模板生成pdf
原文链接:https://www.cnblogs.com/wangpeng00700/p/8418594.html 在网上看了一些Java生成pdf文件的,写的有点乱,有的不支持写入中文字体,有的不支 ...
- python+unittest框架第三天unittest之分离测试固件和公共代码,跳过案例的执行
我们在时间工作中,会将整个项目的代码分别放置多个模块中去编写.方便后期项目维护,比如,我们的web项目可能有多个IP地址,每个IP地址代表不同的测试环境.测试环境与Bat环境或者验收环境等.这就需要我 ...
- Oracle常用指令
/** 为了清晰化的显示:所有固定命令都是用大写格式显示 SQL语法分类:DML,DDL,DCL (1)DML(Data Manipulation Language ,数据库操作语言): 数据:增加 ...
- ubuntu18和windows10双系统时间不同步问题(Ubuntu)
1.安装并校准时间 sudo apt install ntpdate sudo ntpdate time.windows.com 2.写入硬件配置 sudo hwclock --localtime - ...
- jquery绑定input的change事件
### jquery绑定input的change事件 背景:在做一个登录页时,如果用户未输入验证码则无法点击登录按钮,所以想到了用input的change事件,但是在写完后发现无法监听input值的改 ...
- python学习-27 匿名函数
匿名函数 1. 语法: lanbda x:x+1 def a(x): return x+1 res = a(10) print(res) 运行结果: 11 Process finished wit ...