Technical data

lofs(7FS) File Systems SunOS 5.5
NAME lofs loopback virtual file system
SYNOPSIS #include <sys/param.h>
#include <sys/mount.h>
int mount(const char dir, const char virtual, int mflag, lofs , NULL , 0);
DESCRIPTION The loopback file system device allows new, virtual file systems to be created, which pro-
vide 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. However, file systems which are subsequently mounted onto the original file
system 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.
virtual is the mount point for the virtual file system. dir is the pathname of the existing
file system. mflag specifies the mount options; theMS_DATA bit in mflag must be set. If
the MS_RDONLY bit in mflag is not set, accesses to the loop back file system are the same
as for the underlying file system. Otherwise, all accesses in the loop back file system will
be read-only. All other mount(2) options are inherited from the underlyingfile systems.
A loopback mount of ’/’ onto /tmp/newroot allows the entire file system 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 rela-
tive 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 file system 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 file sys-
tem hierarchy; rather, it appears just as /tmp/newroot did before the loopback mount was
performed (for example, as an empty directory).
SEE ALSO mount(1M), chroot(2), mount(2), sysfs(2), vfstab(4)
WARNINGS Loopback mounts must be used with care; the potential for confusing users and applica-
tions is enormous. A loopback mount entry in /etc/vfstab must be placed after the mount
points of both directories it depends on. This is most easily accomplished by making the
loopback mount entry the last in /etc/vfstab.
BUGS Because only directories can be mounted or mounted on, the structure of a virtual file
system can only be modified at directories.
7FS-194 modified 20 Mar 1992