McKown, John wrote:
I understand what these do. Can anybody explain to me why I would use
them? Eg, I could do something like:
mount --rbind /opt/lib/IBM /var/lib/IBM
Now I can get to the same physical files via /opt/lib/IBM or
/var/lib/IBM. I guess that if I messed something up and could not find
the config file, this would be helpful. But how is that better than:
ln -s /opt/lib/IBM /var/lib/IBM
??? The best that I can figure out is if I did something like:
mount -bind /bin /tmp/bin
chroot /tmp /bin/sh
to get to a chroot'ed environment. Is that the reason? Oh, and does it
work? I haven't tried because I'm not where I can easily get to a Linux
system right now.
I use it to allow a chroot jailed developer account to have access to
/opt/tomcat inside his jail. He can then activate his changes with
trigger files... simply create an empty file in a specific location with
a specific name, and a cron job that runs every minute looks for it, if
it's there, do a certain act... for example, restart tomcat.
I have also used it to allow /opt/oracle to be shared. One master copy,
set read only, shared between hosts... bind mounts work on directories
*AND* files. So the master copy has necessary empty stub files, like
.profile, other host or database specific files... but then bind mount
real ones over top of them from /home/oracle. Plus, under the
/opt/oracle/product/x.x.x version tree, there are some subdirectories
oracle wants to write to... those are bind mounted over from
/home/oracle, as well. This allows us to have one oracle installation
between many hosts.
Let's see, we used the Solaris equivalent, called lofs, once on a Sun
box to give us a writable /dev and /devices directories so we could
re-probe devices, when the actual filesystem was demanding to be in
read-only mode. Once devices were re-probed, we now had the proper raw
devices to fsck the file system... so on the next reboot the filesystem
was okay enough to proceed with a successful r/w mount.
What else... I've used bind mounts to stop an NFS export from going
further down a tree than I wanted. I'm sure there were some other uses
I've forgotten. Oh, it's useful as a way to hard-link directories,
since ln won't let you do that. It will only let you do symbolic links
for directories.
But the fact that it can be used to bind mount directories AND for bind
mounting files, it's very handy.
*Brandon Darbro
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390