So I tried to union two directories together and failed. Here is a transcript of what I tried, and based on tutorials and information I've seen from googling around, I'm pretty sure this should work. I guess aufs2 is generally preferred and there's also mddhfs but I can't find any documentation on the latter and the former is not in the repositories (also, I don't want to install build-essentials etc because I actually want to install them in the union, not in the main file system).
Anyway, I set up the following test scenario
user@host:~$ cd Desktop
user@host:~/Desktop$ mkdir test
user@host:~/Desktop$ cd test
user@host:~/Desktop/test$ mkdir test1
user@host:~/Desktop/test$ mkdir test2
user@host:~/Desktop/test$ mkdir test3
user@host:~/Desktop/test$ echo "this is file A" > test1/fileA.txt
user@host:~/Desktop/test$ echo "this is file B" > test2/fileB.txt
Then I merge the test1 and test2 directories as such
unionfs-fuse /home/user/Desktop/test/test1=RW:/home/user/Desktop/test/test2=RO /home/user/Desktop/test/test3
And I get the expected result
user@host:~/Desktop/test$ unionfs-fuse /home/user/Desktop/test/test1=RW:/home/user/Desktop/test/test2=RO /home/user/Desktop/test/test3
user@host:~/Desktop/test$ ls -l test3
-rw-r--r-- 1 user user 14 2010-06-25 11:34 fileA.txt
-rw-r--r-- 1 user user 14 2010-06-25 11:34 fileB.txt
I then unmount the new directory
user@host:~/Desktop/test$ sudo umount test3
And then try this
user@host:~/Desktop/test$ unionfs-fuse /home/user/Desktop/test/test1=RW:/home/user/Desktop/test/test2=RO /home/user/Desktop/test/test1
fuse: mountpoint not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
Which I was definately not expecting. So I figured "what the heck, lets try it"
user@host:~/Desktop/test$ unionfs-fuse /home/user/Desktop/test/test1=RW:/home/user/Desktop/test/test2=RO /home/user/Desktop/test/test1 -o nonempty
user@host:~/Desktop/test$ ls -l test1
The first command executes, but the second freezes... Any one care to explain why? I thought unionfs allowed merging of two directories into one of the two as the mount point. At least, that's what a number of the unionfs tutorials have indicated. Is there a way to do what I want? Some other options?