How to create union of two directories?

In case of unix/linux, is there a way to create union of two directories without copying or linking manually everything to a single directory?


One option is to use unionfs

Unionfs: A Stackable Unification File System

This project builds a stackable unification file system, which can appear to merge the contents of several directories (branches), while keeping their physical content separate. Unionfs is useful for unified source tree management, merged contents of split CD-ROM, merged separate software package directories, data grids, and more. Unionfs allows any mix of read-only and read-write branches, as well as insertion and deletion of branches anywhere in the fan-out.

Or another similar option aufs.


mhddfs is great for making a heap of drives that are transparently linked. It takes some /etc/fstab fiddling, but the solution works great for me

http://blog.mindlesstechie.net/2009/01/19/combine-your-partition-space-with-mhddfs/