1.作用
在固件开发过程中常常遇到这样的情况:为了测试某个新功能,必需要修改某个系统文件,而这个文件在只读文件系统上(总不能为了这个测试就重新刷新固件吧)
或者虽然文件可写,但是自己对这个改动没有把握,不愿意直接修改,这时候使用mount --bind命令
假设我们要改的文件是/etc/hosts,可按下面的步骤操作:
(1)把新的hosts文件放在/tmp下。当然也可放在硬盘或U盘上
(2)mount --bind /tmp/hosts /etc/hosts 此时的/etc目录是可写的,所做修改不会应用到原来的/etc目录,可以放心测试。测试完成了执行 umount /etc/hosts 断开绑定
2.用法
$mount --bind /etc/input-event-daemon_zk.conf /etc/input-event-daemon.conf
$mount 或者 cat /proc/mounts
/dev/root on /etc/input-event-daemon.conf type ext4 (ro,relatime,data=ordered)
$umount /etc/input-event-daemon.conf
3.参考文档
mount --bind使用