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 ...
随机推荐
- k8s常可能问的问题
k8s常可能问的问题 1.为什么要用k8s 自我修复.pod水平自动伸缩.密钥和配置管理动态对应用进行扩容.缩容 服务发现.负载均衡 1.1.自我修复 比如误删pod后会自动创建,用 kind: Re ...
- PostgreSQL学习笔记——内置函数
算术函数(数值计算) +(加).-(减).*(乘)./(除) ABS函数--绝对值: ABS(数值) MOD--求余: MOD(被除数,除数) ROUND--四舍五入: ROUND(对象数值,保留小数 ...
- 手动mvn install指令向maven本地仓库安装jar包
mvn install:install-file -DgroupId=imsdriver(jar包的groupId) -DartifactId=imsdriver(jar包的artifactId) - ...
- 如何创建一个线程安全的Map?
1,使用普通的旧的Hashtable HashMap允许null作为key,而Hashtable不可以 2,使用Collections中同步化的包装方法synchronizedMap 3,使用conc ...
- JS获取URL参数中文乱码解决
var param = window.location.search; var paramArray = parseParams(param); var selectV = decodeURI(par ...
- 深入理解linux内核-内存寻址
逻辑地址:由一个段和偏移量组成的地址线性地址(虚拟地址):物理地址:CPU的物理地址线相对应的地址32或36位 多处理器系统中每个CPU对应一个GDT 局部线程存储:用于线程内部的各个函数调用都能访问 ...
- ASP.NET请求过程-Module
管道模型 上图中为Http请求在Asp.net程序中处理的过程.管道处理模型来自上面的HttpApplication,管道处理模型其实就是多个Module(其实这些module都是在往http ...
- java源码 -- TreeMap
简介 TreeMap 是一个有序的key-value集合,它是通过红黑树实现的.TreeMap 继承于AbstractMap,所以它是一个Map,即一个key-value集合.TreeMap 实现了N ...
- 【Docker】:使用docker安装redis,挂载外部配置和数据
普通安装 1.拉取镜像,redis:4.0 docker pull redis:4.0 2.创建redis容器名"redistest1",并开启持久化 docker run -d ...
- 笔试2019-GRANDSTREAM
程序阅读 随机,因为局部变量在栈中,值随机. 上面那个题在x86上都是12因为x86是大端模式 但是在ARM架构的处理器,因为它们是小端模式,则输出x078 判断回文 int hui(const ch ...