才发现mount的新用法

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
bigsun
帖子: 301
注册时间: 2009-01-11 16:05

才发现mount的新用法

#1

帖子 bigsun » 2009-04-16 20:02

msn mouny
The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file
hierarchy somewhere else. The call is
mount --bind olddir newdir
or fstab entry is:
/olddir /newdir none bind

After this call the same contents is accessible in two places.
One can also remount a single file (on a single file).

This call attaches only (part of) a single filesystem, not pos‐
sible submounts. The entire file hierarchy including submounts
is attached a second place using
mount --rbind olddir newdir

Note that the filesystem mount options will remain the same as
those on the original mount point, and cannot be changed by
passing the -o option along with --bind/--rbind.
The move operation.
Since Linux 2.5.1 it is possible to atomically move a mounted
tree to another place. The call is
mount --move olddir newdir
The shared subtrees operations.
Since Linux 2.6.15 it is possible to mark a mount and its sub‐
mounts as shared, private, slave or unbindable. A shared mount
provides ability to create mirrors of that mount such that
mounts and umounts within any of the mirrors propagate to the
other mirror. A slave mount receives propagation from its mas‐
ter, but any not vice-versa. A private mount carries no propa‐
gation abilities. A unbindable mount is a private mount which
cannot cloned through a bind operation. Detailed semantics is
documented in Documentation/sharedsubtree.txt file in the kernel
source tree.

mount --make-shared mountpoint
mount --make-slave mountpoint
mount --make-private mountpoint
mount --make-unbindable mountpoint

The following commands allows one to recursively change the type
of all the mounts under a given mountpoint.

mount --make-rshared mountpoint
mount --make-rslave mountpoint
mount --make-rprivate mountpoint
mount --make-runbindable mountpoint
头像
hubert_star
论坛版主
帖子: 5373
注册时间: 2007-10-29 22:12
系统: OSX 10.9 + Ub 1304
来自: 江苏南京

Re: 才发现mount的新用法

#3

帖子 hubert_star » 2009-04-16 20:55

就比如你要修复grub时,去chroot之前,就要bind /dev这些内核映射出来的目录,就是这个道理
佛经说,人有八苦: 生、老、病、死、求不得、怨憎、爱别离、五阴盛 故我苦!
圣经说,人有七罪: 饕餮、贪婪、懒惰、淫欲、傲慢、嫉妒和暴怒  故我有罪!

我这篇帖子里面没有任何攻击我们伟大的中华人民共和国政府和任劳任怨的人民公仆(和本论坛高素质的版主)的文字和含义;

特此声明!

有些事,我们明知道是错的,也要去坚持,因为不甘心;有些人,我们明知道是爱的,也要去放弃,因为没结局;有时候,我们明知道没路了,却还在前行,因为习惯了。

欢迎来我的新浪微博@me
头像
lerosua
论坛版主
帖子: 8455
注册时间: 2007-11-29 9:41
联系:

Re: 才发现mount的新用法

#4

帖子 lerosua » 2009-04-16 21:08

呵呵 :em11
回复