Bind Mounts And Context-Dependent Path Names - Red Hat ENTERPRISE LINUX 5 - GLOBAL FILE SYSTEM 2 Manual

Hide thumbs Also See for ENTERPRISE LINUX 5 - GLOBAL FILE SYSTEM 2:
Table of Contents

Advertisement

Bind Mounts and Context-Dependent Path Names

3.12. Bind Mounts and Context-Dependent Path Names
GFS2 file systems do not provide support for Context-Dependent Path Names (CDPNs), which allow
you to create symbolic links that point to variable destination files or directories. For this functionality in
GFS2, you can use the bind option of the mount command.
The bind option of the mount command allows you to remount part of a file hierarchy at a different
location while it is still available at the original location. The format of this command is as follows.
mount --bind olddir newdir
After executing this command, the contents of the olddir directory are available at two locations:
olddir and newdir. You can also use this option to make an individual file available at two
locations.
For example, after executing the following commands the contents of /root/tmp will be identical to
the contents of the previously mounted /var/log directory.
[root@menscryfa ~]# cd ~root
[root@menscryfa ~]# mkdir ./tmp
[root@menscryfa ~]# mount --bind /var/log /tmp
Alternately, you can use an entry in the /etc/fstab file to achieve the same results at mount time.
The following /etc/fstab entry will result in the contents of /root/tmp being identical to the
contents of the /var/log directory.
/var/log
/root/tmp
none
bind
0 0
After you have mounted the file system, you can use the mount command to see that the file system
has been mounted, as in the following example.
[root@menscryfa ~]# mount | grep /tmp
/var/log on /root/tmp type none (rw,bind)
With a file system that supports Context-Dependent Path Names, you might have defined the /
bin directory as a Context-Dependent Path Name that would resolve to one of the following paths,
depending on the system architecture.
/usr/i386-bin
/usr/x86_64-bin
/usr/ppc64-bin
You can achieve this same functionality by creating an empty /bin directory. Then, using a script or
an entry in the /etc/fstab file, you can mount each of the individual architecture directories onto the
/bin directory with a mount -bind command. For example, you can use the following command as
a line in a script.
mount --bind /usr/i386-bin /bin
29

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 5 - GLOBAL FILE SYSTEM 2 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Global file system 2

Table of Contents