Deleted Added
full compact
mount_unionfs.8 (69051) mount_unionfs.8 (77042)
1.\" Copyright (c) 1994
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software donated to Berkeley by
5.\" Jan-Simon Pendry.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\" must display the following acknowledgement:
17.\" This product includes software developed by the University of
18.\" California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\" may be used to endorse or promote products derived from this software
21.\" without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\" @(#)mount_union.8 8.6 (Berkeley) 3/27/94
1.\" Copyright (c) 1994
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software donated to Berkeley by
5.\" Jan-Simon Pendry.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\" must display the following acknowledgement:
17.\" This product includes software developed by the University of
18.\" California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\" may be used to endorse or promote products derived from this software
21.\" without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\" @(#)mount_union.8 8.6 (Berkeley) 3/27/94
36.\" $FreeBSD: head/sbin/mount_unionfs/mount_unionfs.8 69051 2000-11-22 16:02:00Z ru $
36.\" $FreeBSD: head/sbin/mount_unionfs/mount_unionfs.8 77042 2001-05-23 14:58:19Z ru $
37.\"
38.Dd March 27, 1994
37.\"
38.Dd March 27, 1994
39.Dt MOUNT_UNION 8
40.Os BSD 4.4
39.Dt MOUNT_UNIONFS 8
40.Os
41.Sh NAME
41.Sh NAME
42.Nm mount_union
42.Nm mount_unionfs
43.Nd mount union filesystems
44.Sh SYNOPSIS
45.Nm
46.Op Fl br
47.Op Fl o Ar options
48.Ar directory
49.Ar uniondir
50.Sh DESCRIPTION
51The
52.Nm
53command
54attaches
55.Ar directory
56above
57.Ar uniondir
58in such a way that the contents of both directory trees remain visible.
59By default,
60.Ar directory
61becomes the
62.Em upper
63layer and
64.Ar uniondir
65becomes the
66.Em lower
67layer.
68.Pp
69The options are as follows:
70.Bl -tag -width indent
71.It Fl b
72Invert the default position, so that
73.Ar directory
74becomes the lower layer and
75.Ar uniondir
76becomes the upper layer.
77However,
78.Ar uniondir
79remains the mount point.
80.It Fl o
81Options are specified with a
82.Fl o
83flag followed by a comma separated string of options.
84See the
85.Xr mount 8
86man page for possible options and their meanings.
87.It Fl r
88Hide the lower layer completely in the same way as mounting with
43.Nd mount union filesystems
44.Sh SYNOPSIS
45.Nm
46.Op Fl br
47.Op Fl o Ar options
48.Ar directory
49.Ar uniondir
50.Sh DESCRIPTION
51The
52.Nm
53command
54attaches
55.Ar directory
56above
57.Ar uniondir
58in such a way that the contents of both directory trees remain visible.
59By default,
60.Ar directory
61becomes the
62.Em upper
63layer and
64.Ar uniondir
65becomes the
66.Em lower
67layer.
68.Pp
69The options are as follows:
70.Bl -tag -width indent
71.It Fl b
72Invert the default position, so that
73.Ar directory
74becomes the lower layer and
75.Ar uniondir
76becomes the upper layer.
77However,
78.Ar uniondir
79remains the mount point.
80.It Fl o
81Options are specified with a
82.Fl o
83flag followed by a comma separated string of options.
84See the
85.Xr mount 8
86man page for possible options and their meanings.
87.It Fl r
88Hide the lower layer completely in the same way as mounting with
89.Xr mount_null 8 .
89.Xr mount_nullfs 8 .
90.El
91.Pp
92To enforce filesystem security, the user mounting the filesystem
93must be superuser or else have write permission on the mounted-on
94directory.
95.Pp
96Filenames are looked up in the upper layer and then in the
97lower layer.
98If a directory is found in the lower layer, and there is no entry
99in the upper layer, then a
100.Em shadow
101directory will be created in the upper layer.
102It will be owned by the user who originally did the union mount,
103with mode
104.Dq rwxrwxrwx
105(0777) modified by the umask in effect at that time.
106.Pp
107If a file exists in the upper layer then there is no way to access
108a file with the same name in the lower layer.
109If necessary, a combination of loopback and union mounts can be made
110which will still allow the lower files to be accessed by a different
111pathname.
112.Pp
113Except in the case of a directory,
114access to an object is granted via the normal filesystem access checks.
115For directories, the current user must have access to both the upper
116and lower directories (should they both exist).
117.Pp
118Requests to create or modify objects in
119.Ar uniondir
120are passed to the upper layer with the exception of a few special cases.
121An attempt to open for writing a file which exists in the lower layer
122causes a copy of the
123.Em entire
124file to be made to the upper layer, and then for the upper layer copy
125to be opened.
126Similarly, an attempt to truncate a lower layer file to zero length
127causes an empty file to be created in the upper layer.
128Any other operation which would ultimately require modification to
129the lower layer fails with
130.Er EROFS .
131.Pp
132The union filesystem manipulates the namespace, rather than
133individual filesystems.
134The union operation applies recursively down the directory tree
135now rooted at
136.Ar uniondir .
137Thus any filesystems which are mounted under
138.Ar uniondir
139will take part in the union operation.
140This differs from the
141.Em union
142option to
143.Xr mount 8
144which only applies the union operation to the mount point itself,
145and then only for lookups.
146.Sh EXAMPLES
147The commands
148.Bd -literal -offset indent
149mount -t cd9660 -o ro /dev/cd0a /usr/src
90.El
91.Pp
92To enforce filesystem security, the user mounting the filesystem
93must be superuser or else have write permission on the mounted-on
94directory.
95.Pp
96Filenames are looked up in the upper layer and then in the
97lower layer.
98If a directory is found in the lower layer, and there is no entry
99in the upper layer, then a
100.Em shadow
101directory will be created in the upper layer.
102It will be owned by the user who originally did the union mount,
103with mode
104.Dq rwxrwxrwx
105(0777) modified by the umask in effect at that time.
106.Pp
107If a file exists in the upper layer then there is no way to access
108a file with the same name in the lower layer.
109If necessary, a combination of loopback and union mounts can be made
110which will still allow the lower files to be accessed by a different
111pathname.
112.Pp
113Except in the case of a directory,
114access to an object is granted via the normal filesystem access checks.
115For directories, the current user must have access to both the upper
116and lower directories (should they both exist).
117.Pp
118Requests to create or modify objects in
119.Ar uniondir
120are passed to the upper layer with the exception of a few special cases.
121An attempt to open for writing a file which exists in the lower layer
122causes a copy of the
123.Em entire
124file to be made to the upper layer, and then for the upper layer copy
125to be opened.
126Similarly, an attempt to truncate a lower layer file to zero length
127causes an empty file to be created in the upper layer.
128Any other operation which would ultimately require modification to
129the lower layer fails with
130.Er EROFS .
131.Pp
132The union filesystem manipulates the namespace, rather than
133individual filesystems.
134The union operation applies recursively down the directory tree
135now rooted at
136.Ar uniondir .
137Thus any filesystems which are mounted under
138.Ar uniondir
139will take part in the union operation.
140This differs from the
141.Em union
142option to
143.Xr mount 8
144which only applies the union operation to the mount point itself,
145and then only for lookups.
146.Sh EXAMPLES
147The commands
148.Bd -literal -offset indent
149mount -t cd9660 -o ro /dev/cd0a /usr/src
150mount -t union /var/obj /usr/src
150mount -t unionfs /var/obj /usr/src
151.Ed
152.Pp
153mount the CD-ROM drive
154.Pa /dev/cd0a
155on
156.Pa /usr/src
157and then attaches
158.Pa /var/obj
159on top.
160For most purposes the effect of this is to make the
161source tree appear writable
162even though it is stored on a CD-ROM.
163.Pp
164The command
165.Bd -literal -offset indent
151.Ed
152.Pp
153mount the CD-ROM drive
154.Pa /dev/cd0a
155on
156.Pa /usr/src
157and then attaches
158.Pa /var/obj
159on top.
160For most purposes the effect of this is to make the
161source tree appear writable
162even though it is stored on a CD-ROM.
163.Pp
164The command
165.Bd -literal -offset indent
166mount -t union -o -b /sys $HOME/sys
166mount -t unionfs -o -b /sys $HOME/sys
167.Ed
168.Pp
169attaches the system source tree below the
170.Pa sys
171directory in the user's home directory.
172This allows individual users to make private changes
173to the source, and build new kernels, without those
174changes becoming visible to other users.
175Note that the files in the lower layer remain
176accessible via
177.Pa /sys .
178.Sh SEE ALSO
179.Xr intro 2 ,
180.Xr mount 2 ,
181.Xr unmount 2 ,
182.Xr fstab 5 ,
183.Xr mount 8 ,
184.Xr mount_null 8
185.Sh BUGS
186THIS FILESYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK)
187AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM. USE AT YOUR
188OWN RISK. BEWARE OF DOG. SLIPPERY WHEN WET.
189.Pp
190This code also needs an owner in order to be less dangerous - serious
191hackers can apply by sending mail to
192.Aq hackers@FreeBSD.org
193and announcing
194their intent to take it over.
195.Pp
196Without whiteout support from the filesystem backing the upper layer,
197there is no way that delete and rename operations on lower layer
198objects can be done.
199.Er EROFS
200is returned for this kind of operations along with any others
201which would make modifications to the lower layer, such as
202.Xr chmod 1 .
203.Pp
204Running
205.Xr find 1
206over a union tree has the side-effect of creating
207a tree of shadow directories in the upper layer.
208.Sh HISTORY
209The
210.Nm
211command first appeared in
212.Bx 4.4 .
213It first worked in
214.Fx Ns -(fill this in) .
167.Ed
168.Pp
169attaches the system source tree below the
170.Pa sys
171directory in the user's home directory.
172This allows individual users to make private changes
173to the source, and build new kernels, without those
174changes becoming visible to other users.
175Note that the files in the lower layer remain
176accessible via
177.Pa /sys .
178.Sh SEE ALSO
179.Xr intro 2 ,
180.Xr mount 2 ,
181.Xr unmount 2 ,
182.Xr fstab 5 ,
183.Xr mount 8 ,
184.Xr mount_null 8
185.Sh BUGS
186THIS FILESYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK)
187AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM. USE AT YOUR
188OWN RISK. BEWARE OF DOG. SLIPPERY WHEN WET.
189.Pp
190This code also needs an owner in order to be less dangerous - serious
191hackers can apply by sending mail to
192.Aq hackers@FreeBSD.org
193and announcing
194their intent to take it over.
195.Pp
196Without whiteout support from the filesystem backing the upper layer,
197there is no way that delete and rename operations on lower layer
198objects can be done.
199.Er EROFS
200is returned for this kind of operations along with any others
201which would make modifications to the lower layer, such as
202.Xr chmod 1 .
203.Pp
204Running
205.Xr find 1
206over a union tree has the side-effect of creating
207a tree of shadow directories in the upper layer.
208.Sh HISTORY
209The
210.Nm
211command first appeared in
212.Bx 4.4 .
213It first worked in
214.Fx Ns -(fill this in) .