2 .\" Copyright 2014 Nexenta Systems, Inc. All Rights Reserved.
3 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
5 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
6 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH LOFS 7FS "Nov 24, 2014"
9 lofs \- loopback virtual file system
13 #include <sys/param.h>
14 #include <sys/mount.h>
16 \fBint\fR \fBmount\fR (\fBconst char *\fR\fIdir\fR, \fBconst char *\fR\fIvirtual\fR, \fBint\fR \fImflag\fR, \fB"lofs"\fR, \fBNULL\fR, \fB0\fR);
21 The loopback file system device allows new, virtual file systems to be created,
22 which provide access to existing files using alternate pathnames. Once the
23 virtual file system is created, other file systems can be mounted within it,
24 without affecting the original file system. However, file systems which are
25 subsequently mounted onto the original file system \fIare\fR visible to the
26 virtual file system, unless or until the corresponding mount point in the
27 virtual file system is covered by a file system mounted there.
30 \fIvirtual\fR is the mount point for the virtual file system. \fIdir\fR is the
31 pathname of the existing file system. \fImflag\fR specifies the mount options;
32 the \fBMS_DATA\fR bit in \fImflag\fR must be set. If the \fBMS_RDONLY\fR bit
33 in \fImflag\fR is not set, accesses to the loop back file system are the same
34 as for the underlying file system. Otherwise, all accesses in the loopback file
35 system will be read-only. All other \fBmount\fR(2) options are inherited from
36 the underlying file systems.
39 A loopback mount of '\fB/\fR' onto \fB/tmp/newroot\fR allows the entire file
40 system hierarchy to appear as if it were duplicated under \fB/tmp/newroot\fR,
41 including any file systems mounted from remote \fBNFS\fR servers. All files
42 would then be accessible either from a pathname relative to '\fB/\fR' or from a
43 pathname relative to \fB/tmp/newroot\fR until such time as a file system is
44 mounted in \fB/tmp/newroot\fR, or any of its subdirectories.
47 Loopback mounts of '\fB/\fR' can be performed in conjunction with the
48 \fBchroot\fR(2) system call, to provide a complete virtual file system to a
49 process or family of processes.
52 Recursive traversal of loopback mount points is not allowed. After the loopback
53 mount of \fB/tmp/newroot\fR, the file \fB/tmp/newroot/tmp/newroot\fR does not
54 contain yet another file system hierarchy; rather, it appears just as
55 \fB/tmp/newroot\fR did before the loopback mount was performed (for example, as
59 \fBlofs\fR file systems are mounted using:
63 \fBmount\fR \fB-F\fR lofs /tmp /mnt
70 \fBlofiadm\fR(1M), \fBmount\fR(1M), \fBchroot\fR(2), \fBmount\fR(2),
71 \fBsysfs\fR(2), \fBvfstab\fR(4), \fBlofi\fR(7D)
74 All access to entries in \fBlofs\fR mounted file systems map to their
75 underlying file system. If a mount point is made available in multiple
76 locations via \fBlofs\fR and is busy in any of those locations, an attempt to
77 mount a file system at that mount point fails unless the overlay flag is
78 specified. See \fBmount\fR(1M). Examples of a mount point being busy within a
79 \fBlofs\fR mount include having a file system mounted on it or it being a
80 processes' current working directory.
83 Because of the potential for confusing users and applications, you should use
84 loopback mounts with care. A loopback mount entry in \fB/etc/vfstab\fR must be
85 placed after the mount points of both directories it depends on. This is most
86 easily accomplished by making the loopback mount entry the last in