Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is
mount --bind olddir newdir
After this call the same contents is accessible in two places. One can also remount a single file (on a singlefile).
比如:
# mkdir dir1 dir2
# mount --bind ./dir1 ./dir2
# mount
/usr/local/app/dir1 on /usr/local/app/dir2 type none (rw,bind)
# touch dir1/test.txt
ls dir1 dir2
发现两个目录都有test.txt了。 这个功能就好似于硬链接/软链接。 应用的场景, 我估计是有一些web服务器或者ftp服务器, 不支持读入到软/硬链接里面去。
阅读(1270) | 评论(0) | 转发(0) |