1 .\" $NetBSD: mount_union.8,v 1.18 2008/02/05 16:54:07 ad Exp $
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software donated to Berkeley by
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)mount_union.8 8.7 (Berkeley) 5/1/95
40 .Nd mount union filesystems
54 in such a way that the contents of both directory trees remain visible.
69 are converted to absolute paths before use.
71 The options are as follows:
72 .Bl -tag -width indent
74 Invert the default position, so that
76 becomes the lower layer and
78 becomes the upper layer.
81 remains the mount point.
83 Options are specified with a
85 flag followed by a comma separated string of options.
88 man page for possible options and their meanings.
91 Filenames are looked up in the upper layer and then in the
93 If a directory is found in the lower layer, and there is no entry
94 in the upper layer, then a
96 directory will be created in the upper layer.
97 It will be owned by the user who originally did the union mount,
101 modified by the umask in effect at that time.
103 If a file exists in the upper layer then there is no way to access
104 a file with the same name in the lower layer.
105 If necessary, a combination of loopback and union mounts can be made
106 which will still allow the lower files to be accessed by a different
109 Except in the case of a directory,
110 access to an object is granted via the normal filesystem access checks.
111 For directories, the current user must have access to both the upper
112 and lower directories (should they both exist).
114 Requests to create or modify objects in
116 are passed to the upper layer with the exception of a few special cases.
117 An attempt to open for writing a file which exists in the lower layer
120 file to be made to the upper layer, and then for the upper layer copy
122 Similarly, an attempt to truncate a lower layer file to zero length
123 causes an empty file to be created in the upper layer.
124 Any other operation which would ultimately require modification to
125 the lower layer fails with
128 The union filesystem manipulates the namespace, rather than
129 individual filesystems.
130 The union operation applies recursively down the directory tree
133 Thus any filesystems which are mounted under
135 will take part in the union operation.
136 This differs from the
140 which only applies the union operation to the mount point itself,
141 and then only for lookups.
144 .Bd -literal -offset indent
145 mount -t cd9660 -o ro /dev/cd0a /usr/src
146 mount -t union /var/obj /usr/src
158 For most purposes the effect of this is to make the
159 source tree appear writable
160 even though it is stored on a
164 .Bd -literal -offset indent
165 mount -t union -o -b /sys $HOME/sys
168 attaches the system source tree below the
170 directory in the user's home directory.
171 This allows individual users to make private changes
172 to the source, and build new kernels, without those
173 changes becoming visible to other users.
174 Note that the files in the lower layer remain
189 command first appeared in
192 Without whiteout support from the filesystem backing the upper layer,
193 there is no way that delete and rename operations on lower layer
195 An attempt to mount a union directory under one which does not
196 have whiteout support will return
198 .Pq Qq Operation not supported .
199 Whiteout support can be added to an existing FFS filesystem
207 over a union tree has the side-effect of creating
208 a tree of shadow directories in the upper layer.