mount命令里的bind选项

字体: | 打印

mount显示:

/dev/mtdblock0 on /flash type jffs2 (rw)
/dev/mtdblock0 on /etc type jffs2 (rw)

看到的现象是这样,我们再看一看启动脚本,为什么是这样:

先是mount /dev/mtdblock0 /flash
然后看一下/flash里内容,有一个目录 etc
然后mount --bind /flash/etc /etc
这样/etc里的内容就是/flash/etc里的内容了

用的linux是uClinux,image里包含了kernel+rootfs,当然也有/etc配置目录

这样处理的用处,大约是:
如果mtdblock0分区上已有etc配置文件,则不使用自带的
如果没有,则将其copy到mtdblock0上

下面是man mount对bind选项的说明:

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.

我也来说两句 查看全部评论 相关评论

  • jpl2000 (2006-8-11 12:25:50)

    谢谢指教