Example usage 'overlayfs' using
Create the necessary directories.
Lets create a fake block device to hold our "lower" filesystem.
dd if=/dev/zero of=lower-fs.assets bs=4096 count=102400
dd if=/dev/zero of=upper-fs.assets bs=4096 count=102400
Give this block device an ext4 filesystem.
Mount the filesystem we just created and give it a file.
sudo mount lower-fs.assets ~/tmp/lower
sudo chown $USER:$USER ~/tmp/lower
echo "hello world" >> ~/tmp/lower/lower-file.txt
Remount the lower filesystem as read only just for giggles.
Mount the upper filesystem
Create the workdir in the upper filesystem and the directory in the upper filesystem that will act as the upper directory (they both have to be in the same filesystem)
Create our overlayfs mount
sudo mount -t overlay -o lowerdir=~/tmp/lower,upperdir=~/tmp/upper,workdir=~/tmp/workdir my-overlay-mount merge
Example usage 'unionfs'
Create needed directories.
Mount in user space 2 directories into directory 'merge'