4.12. Bind Mounts and Context-Dependent Path Names
bindoption of the
bindoption of the
mountcommand 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.
olddirdirectory are available at two locations:
newdir. You can also use this option to make an individual file available at two locations.
/root/tmpwill be identical to the contents of the previously mounted
cd ~root[root@menscryfa ~]#
mkdir ./tmp[root@menscryfa ~]#
mount --bind /var/log /tmp
/etc/fstabfile to achieve the same results at mount time. The following
/etc/fstabentry will result in the contents of
/root/tmpbeing identical to the contents of the
/var/log /root/tmp none bind 0 0
mountcommand to see that the file system has been mounted, as in the following example.
mount | grep /tmp/var/log on /root/tmp type none (rw,bind)
/bindirectory 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
/bindirectory. Then, using a script or an entry in the
/etc/fstabfile, you can mount each of the individual architecture directories onto the
/bindirectory with a
mount -bindcommand. For example, you can use the following command as a line in a script.
mount --bind /usr/i386-bin /bin
/usr/1386-bin /bin none bind 0 0
%fillfor the file system). Context-Dependent Path Names are more limited in what they can encompass. Note, however, that you will need to write your own script to mount according to a criteria such as the value of
bindoption and the original file system was mounted
rw, the new file system will also be mounted
rweven if you use the
roflag is silently ignored. In this case, the new file system might be marked as
/proc/mountsdirectory, which may be misleading.