unionfs is a filesystem that allows directories of seperate fileystems to be transparently overlaid to form a signel filesystem. Thus, it can be used to merge directories in different filesystems together into one ceherent directory.

Error

From the mount_union(8) manual page: THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN’T WORK) AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM. USE AT YOUR OWN RISK.

Use nullfs

If you want to use unionfs to merge a given directory into other directories without merging them on subfolder level consider using nullfs.

Use unionfs with fstab

To create unionfs mounts with fstab(5) directly during boot the following line can be added to /etc/fstab:

# Device         Mountpoint            FStype  Options            Dump    Pass#
<source_folder>  <destination_folder>  unionfs rw,late,noatime    0       0

In this example a source folder will be mounted into a destination folder with an option of noatime. This will diasable the access time monitoring. The option late is mandatory here to mount the unionfs filesystem after all upstream mounts are finished.

Important option late

The option late in fstab is important and in most cases mandatory when mounting a unionfs filesystem, since it will mount folders that are relying on other filesystem mounts defined via fstab. The dependent unionfs mounts therefore need to be mounted late. Otherwise they will not be available and throw an error.