--On Wednesday, October 12, 2005 12:44 AM -0500 Mike McCarty
<mike.mccarty@xxxxxxxxxxxxx> wrote:
So, though I'm familiar with the *term* "loopback", and I've mounted
ISO images using "the loopback device", I really am pretty much
clueless about what the term "loopback" refers to. I'm familiar with
both hard and soft links, however.
Would you mind specifying what the distinction between
using a soft link and using a loopback mount would be?
And why one would prefer the latter to the former?
I think I'm actually using it as I learned it when administering SunOS 4
systems in the late 80's, but the concept is simple enough: A loopback in
software is a mechanism that lets you route bits through a driver as if
they went to real hardware, but they really just turn around and come back
in through another "device" (in the software sense, ie. a driver instance).
In networking the 127.0.0.1 address is implemented as a loopback device.
It's as if you had an Ethernet card with the transmit and receive wired
together. (Which would make any Ethernet hardware expert cringe; you'd
actually need more hardware than that.)
For filesystems, a loopback mount is one where references to one filesystem
are passed to another filesystem that's already mounted. There's no
hardware in the middle. It's just bits moving from one driver to another.
Most people are familiar with the use of the loop device to mount a
filesystem image of a CD. The ability to just mount a tree from an existing
filesystem is more recent in Linux. (Recent versions of Windows finally
have this capability. Late versions of DOS just before Win95 had it in the
form of the JOIN command.)
A "soft link" (symbolic link) has some restrictions in the kernel, and is
visible to userland apps in a way that a mount point is not. Most utilities
and API's traverse mount points without knowledge of their existence, but
many make a point of not crossing symlinks, typically for security reasons.
For instance, Apache by default won't cross a symlink unless you explicitly
allow it in an access control file.
It's very common to mount a separate filesystem for /tmp, and then set the
special permissions required on /tmp. (Some systems use a RAM filesystem
for /tmp for performance. This can be a good choice if you have a UPS to
protect the system from unexpected shutdowns, or if you have no apps that
require a persistent /tmp.)