📄 mount_union.8
字号:
.\" Copyright (c) 1994.\" The Regents of the University of California. All rights reserved..\" .\" This code is derived from software donated to Berkeley by.\" Jan-Simon Pendry..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by the University of.\" California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)mount_union.8 8.6 (Berkeley) 3/27/94.\".Dd March 27, 1994.Dt MOUNT_UNION 8.Os BSD 4.4.Sh NAME.Nm mount_union.Nd mount union filesystems.Sh SYNOPSIS.Nm mount_union.Op Fl br.Op Fl o Ar options.Ar directory.Ar uniondir.Sh DESCRIPTIONThe.Nm mount_unioncommandattaches.Ar directoryabove.Ar uniondirin such a way that the contents of both directory trees remain visible.By default,.Ar directorybecomes the.Em upperlayer and.Ar uniondirbecomes the.Em lowerlayer..PpThe options are as follows:.Bl -tag -width indent.It Fl bInvert the default position, so that.Ar directorybecomes the lower layer and.Ar uniondirbecomes the upper layer.However,.Ar uniondirremains the mount point..It Fl oOptions are specified with a.Fl oflag followed by a comma separated string of options.See the.Xr mount 8man page for possible options and their meanings..It Fl rHide the lower layer completely in the same way as mounting with.Xr mount_lofs 8or.Xr mount_null 8 ..El.PpTo enforce filesystem security, the user mounting the filesystemmust be superuser or else have write permission on the mounted-ondirectory..PpFilenames are looked up in the upper layer and then in thelower layer.If a directory is found in the lower layer, and there is no entryin the upper layer, then a.Em shadowdirectory will be created in the upper layer.It will be owned by the user who originally did the union mount,with mode.Dq rwxrwxrwx(0777) modified by the umask in effect at that time..PpIf a file exists in the upper layer then there is no way to accessa file with the same name in the lower layer.If necessary, a combination of loopback and union mounts can be madewhich will still allow the lower files to be accessed by a differentpathname..PpExcept in the case of a directory,access to an object is granted via the normal filesystem access checks.For directories, the current user must have access to both the upperand lower directories (should they both exist)..PpRequests to create or modify objects in.Ar uniondirare passed to the upper layer with the exception of a few special cases.An attempt to open for writing a file which exists in the lower layercauses a copy of the.Em entirefile to be made to the upper layer, and then for the upper layer copyto be opened.Similarly, an attempt to truncate a lower layer file to zero lengthcauses an empty file to be created in the upper layer.Any other operation which would ultimately require modification tothe lower layer fails with.Dv EROFS ..PpThe union filesystem manipulates the namespace, rather thanindividual filesystems.The union operation applies recursively down the directory treenow rooted at.Ar uniondir .Thus any filesystems which are mounted under.Ar uniondirwill take part in the union operation.This differs from the.Em unionoption to.Xr mount 8which only applies the union operation to the mount point itself,and then only for lookups..Sh EXAMPLESThe commands.Bd -literal -offset indentmount -t cd9660 -o ro /dev/cd0a /usr/srcmount -t union -o /var/obj /usr/src.Ed.Ppmount the CD-ROM drive.Pa /dev/cd0aon.Pa /usr/srcand then attaches.Pa /var/objon top.For most purposes the effect of this is to make thesource tree appear writableeven though it is stored on a CD-ROM..PpThe command.Bd -literal -offset indentmount -t union -o -b /sys $HOME/sys.Ed.Ppattaches the system source tree below the.Pa sysdirectory in the user's home directory.This allows individual users to make private changesto the source, and build new kernels, without thosechanges becoming visible to other users.Note that the files in the lower layer remainaccessible via.Pa /sys ..Sh SEE ALSO.Xr intro 2 ,.Xr mount 2 ,.Xr unmount 2 ,.Xr fstab 5 ,.Xr mount 8 ,.Xr mount_lofs 8 ,.Xr mount_null 8.Sh BUGSWithout whiteout support from the filesystem backing the upper layer,there is no way that delete and rename operations on lower layerobjects can be done..Dv EROFSis returned for this kind of operations along with any otherswhich would make modifications to the lower layer, such as.Xr chmod 1 ..PpRunning.Xr find 1over a union tree has the side-effect of creatinga tree of shadow directories in the upper layer..Sh HISTORYThe.Nm mount_unioncommand first appeared in.Bx 4.4 .
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -