Linux – How make multiple directories appear as one to a user on linux

filesystemslinux

I have three directories on a linux (Red Hat) system. Say /usr/local/one, /usr/local/two, and /usr/local/three. I would like to have a mechanism which behaves like a directory which combines the contents of one, two, and three into /opt/oneTwoThree without physically moving their files contents.

i.e…

$ find /usr/local/
/usr/local/one
/usr/local/one/aaa
/usr/local/one/bbb
/usr/local/three
/usr/local/three/fff
/usr/local/two
/usr/local/two/ccc
/usr/local/two/ddd
/usr/local/two/eee

$ find /opt/oneTwoThree
/usr/local/oneTwoThree
/usr/local/oneTwoThree/aaa
/usr/local/oneTwoThree/bbb
/usr/local/oneTwoThree/fff
/usr/local/oneTwoThree/ccc
/usr/local/oneTwoThree/ddd
/usr/local/oneTwoThree/eee

Best Answer

You can use UnionFS that seems to be actively developed or in case of the directories being separated hard drives, MHDDFS, but I see less references to that last one.

EDIT: There's an wikipedia article with more palatable info on UnionFS