System information
18.2.3. Sharing Mount s
Occasionally, certain system administration tasks require access to the same file system from more
than one place in the directory tree (for example, when preparing a chroot environment). This is
possible, and Linux allows you to mount the same file system to as many directories as necessary.
Additionally, the mo unt command implements the --bi nd option that provides a means for
duplicating certain mounts. Its usage is as follows:
mo unt --bi nd old_directory new_directory
Although this command allows a user to access the file system from both places, it does not apply on
the file systems that are mounted within the original directory. To include these mounts as well, type:
mo unt --rbi nd old_directory new_directory
Additionally, to provide as much flexibility as possible, Red Hat Enterprise Linux 6 implements the
functionality known as shared subtrees. This feature allows the use of the following four mount types:
Sh ared Mo u n t
A shared mount allows the creation of an exact replica of a given mount point. When a
mount point is marked as a shared mount, any mount within the original mount point is
reflected in it, and vice versa. To change the type of a mount point to a shared mount, type
the following at a shell prompt:
mo unt --make-shared mount_point
Alternatively, to change the mount type for the selected mount point and all mount points
under it, type:
mo unt --make-rshared mount_point
See Example 18.4, “ Creating a Shared Mount Point” for an example usage.
Examp le 18.4 . Creat in g a Sh ared Mo u n t Po in t
There are two places where other file systems are commonly mounted: the /med i a
directory for removable media, and the /mnt directory for temporarily mounted file
systems. By using a shared mount, you can make these two directories share the same
content. To do so, as ro o t, mark the /med i a directory as “ shared” :
~]# mo unt --bi nd /med i a /med i a
~]# mo unt --make-shared /med i a
Then create its duplicate in /mnt by using the following command:
~]# mo unt --bi nd /med i a /mnt
It is now possible to verify that a mount within /med i a also appears in /mnt. For
example, if the CD-ROM drive contains non-empty media and the /med ia/cd ro m/
directory exists, run the following commands:
Chapt er 1 8 . Using t he mount Command
137