LOFS(4S) — DEVICES AND NETWORK INTERFACES
NAME
lofs − loopback virtual file system
CONFIG
options LOFS
SYNOPSIS
#include <sys/mount.h>
mount(MOUNT_LOFS, virtual, flags, dir);
virtual is the mount point for the virtual file system. dir is the pathname of the existing file system. flags is either 0 or M_RDONLY. The M_RDONLY flag forces all accesses in the new name space to be read-only; without it, accesses are the same as for the underlying file system. All other mount(2) flags are preserved from the underlying file systems.
DESCRIPTION
The loopback filesystem device allows new, virtual, file systems to be created, which provide access to existing files using alternate pathnames. Once the virtual file system is created, other file systems can be mounted within it without affecting the original file system. File systems that are subsequently mounted onto the original filesystem, however, are visible to the virtual file system, unless or until the corresponding mount point in the virtual file system is covered by a file system mounted there.
For instance, a loopback mount of / onto /tmp/newroot allows the entire filesystem hierarchy to appear as if it were duplicated under /tmp/newroot, including any file systems mounted from remote NFS servers. All files would then be accessible either from a pathname relative to /, or from a pathname relative to /tmp/newroot until such time as a file system is mounted in /tmp/newroot, or any of its subdirectories.
Loopback mounts of / can be performed in conjunction with the chroot(2) system call, to provide a complete virtual filesystem to a process or family of processes.
Recursive traversal of loopback mount points is not allowed; after the loopback mount of /tmp/newroot, the file /tmp/newroot/tmp/newroot does not contain yet another filesystem hierarchy; rather, it appears just as /tmp/newroot did before the loopback mount was performed (say, as an empty directory).
SEE ALSO
BUGS
Because only directories can be mounted or mounted on, the structure of a virtual file system can only be modified at directories.
Loopback mounts must be used with care; the potential for confusing users and applications is enormous.
Sun Release 4.0 — Last change: 9 October 1987