1lofs(7FS) File Systems lofs(7FS)
2
3
4
6 lofs - loopback virtual file system
7
9 #include <sys/param.h>
10 #include <sys/mount.h>
11
12 int mount (const char* dir, const char* virtual, int mflag, lofs, NULL, 0);
13
14
16 The loopback file system device allows new, virtual file systems to be
17 created, which provide access to existing files using alternate path‐
18 names. Once the virtual file system is created, other file systems can
19 be mounted within it, without affecting the original file system. How‐
20 ever, file systems which are subsequently mounted onto the original
21 file system are visible to the virtual file system, unless or until the
22 corresponding mount point in the virtual file system is covered by a
23 file system mounted there.
24
25
26 virtual is the mount point for the virtual file system. dir is the
27 pathname of the existing file system. mflag specifies the mount
28 options; the MS_DATA bit in mflag must be set. If the MS_RDONLY bit
29 in mflag is not set, accesses to the loop back file system are the
30 same as for the underlying file system. Otherwise, all accesses in the
31 loopback file system will be read-only. All other mount(2) options are
32 inherited from the underlying file systems.
33
34
35 A loopback mount of '/' onto /tmp/newroot allows the entire file system
36 hierarchy to appear as if it were duplicated under /tmp/newroot,
37 including any file systems mounted from remote NFS servers. All files
38 would then be accessible either from a pathname relative to '/' or from
39 a pathname relative to /tmp/newroot until such time as a file system is
40 mounted in /tmp/newroot, or any of its subdirectories.
41
42
43 Loopback mounts of '/' can be performed in conjunction with the
44 chroot(2) system call, to provide a complete virtual file system to a
45 process or family of processes.
46
47
48 Recursive traversal of loopback mount points is not allowed. After the
49 loopback mount of /tmp/newroot, the file /tmp/newroot/tmp/newroot does
50 not contain yet another file system hierarchy; rather, it appears just
51 as /tmp/newroot did before the loopback mount was performed (for exam‐
52 ple, as an empty directory).
53
54 Examples
55 lofs file systems are mounted using:
56
57 mount -F lofs /tmp /mnt
58
59
60
62 lofiadm(1M), mount(1M), chroot(2), mount(2), sysfs(2), vfstab(4),
63 lofi(7D)
64
66 All access to entries in lofs mounted file systems map to their under‐
67 lying file system. If a mount point is made available in multiple loca‐
68 tions via lofs and is busy in any of those locations, an attempt to
69 mount a file system at that mount point fails unless the overlay flag
70 is specified. See mount(1M). Examples of a mount point being busy
71 within a lofs mount include having a file system mounted on it or it
72 being a processes' current working directory.
73
75 Because of the potential for confusing users and applications, you
76 should use loopback mounts with care. A loopback mount entry in
77 /etc/vfstab must be placed after the mount points of both directories
78 it depends on. This is most easily accomplished by making the loop‐
79 back mount entry the last in /etc/vfstab.
80
81
82
83SunOS 5.11 31 Aug 2009 lofs(7FS)