up | Inhaltsverzeichniss | Kommentar

Manual page for LOFS(4S)

lofs - loopback virtual file system


options LOFS


#include <sys/mount.h>
mount(MOUNT_LOFS, virtual, flags, dir);


The loopback file system 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 file system, 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.

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.2v flags are preserved from the underlying file 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 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 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 system hierarchy; rather, it appears just as /tmp/newroot did before the loopback mount was performed (say, as an empty directory).

The standard RC files perform first 4.2 mounts, then nfs mounts, during booting. On Sun386i systems, lo (loopback) mounts are performed just after 4.2 mounts. /etc/fstab files depending on alternate mount orders at boot time will fail to work as expected. Manual modification of /etc/rc.local will be needed to make such mount orders work.


Loopback mounts must be used with care; the potential for confusing users and applications is enormous. A loopback mount entry in /etc/fstab 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/fstab, though see mount.8 for further warnings.


chroot.2 mount.2v fstab.5 mount.8


Because only directories can be mounted or mounted on, the structure of a virtual file system can only be modified at directories.

index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97