Start of change

Managing the union file system (UFS)

The union file system (UFS) provides a merged view of two or more directories. This merged view is obtained by accessing the mount point of the union file system. As an example, given the two directory hierarchies in the upperdir and lowerdir, the mount point hierarchy (dirM) is the root of the UFS file system that would result from the following mount command.
mount -t ufs -o upperdir=dir1,lowerdir=dir2,workdir=wrk -f myufs dirM
The merged view of two file systems

Directories dir1 and dir2 are merged and that union is accessed from the UFS mount point directory dirM. When you create the union, directories with the same name (dirX) are merged. When files are encountered with the same name (for example, dirX/file1), only one will exist. The workdir option must be specified on the mount but is not actively used in the merged view. It acts as a temporary work directory for certain operations.

The directory that is specified in the mount parameter upperdir takes precedence over the directory that is specified in the lowerdir option during path name resolution. In this example, dir1 takes precedence and you will see the version of file1 that is in the dir1 directory.

For more information about the mount options, see Mounting a union file system.

Containers and the union file system

Union file systems are used extensively by containers. With union file systems, containers can use a single file system hierarchy without having to make multiple copies, which saves on disk space. Changes that are made by one container do not affect the other containers. Other possible uses of union file systems include creating an isolated environment to test a series of file changes and manipulations without affecting the existing file system hierarchy.

Restrictions for the union file system

The following restrictions apply to the union file system.
  1. Directories in an NFS file system cannot be used in the union file system mount options.
  2. Directories in a union file system cannot be used in the union file system mount options.
  3. The union file system cannot be exported.
  4. The directory that is used in the upper directory can only be used in one union file system.
  5. If any of the underlying file systems of a union file system is unmounted, it will become unusable and all operations will fail.
End of change