0

I have been trying to mount directories in linux additively and fail to do so. I have three directrories a, b and c. a contains file x, b contains file y and c contains file z. Now when i mount "a" and "b" into c and then open c there are only x and y present in "c". when i mount a, b and c into c the directory c is empty and ls says permission denied. i cannot also unmount c even with sudo. What i want to do is to mount a b and c in one of them and be able to see x y and z all together. is it possible or is there a solution to this problem please let me know.

naveed@ubuntu:~$ mkdir /tmp/test1 /tmp/test2 /tmp/test3
naveed@ubuntu:~$ touch /tmp/test{1,2,3}/{a,b,c}
naveed@ubuntu:~$ rm /tmp/test1/{b,c}
naveed@ubuntu:~$ rm /tmp/test2/{a,c}
naveed@ubuntu:~$ rm /tmp/test3/{a,b}
naveed@ubuntu:~$ ls -al /tmp/test*/
/tmp/test1/:
total 16
drwxrwxr-x  2 naveed naveed  4096 Mar  9 15:00 .
drwxrwxrwt 11 root   root   12288 Mar  9 15:00 ..
-rw-rw-r--  1 naveed naveed     0 Mar  9 15:00 a

/tmp/test2/:
total 16
drwxrwxr-x  2 naveed naveed  4096 Mar  9 15:00 .
drwxrwxrwt 11 root   root   12288 Mar  9 15:00 ..
-rw-rw-r--  1 naveed naveed     0 Mar  9 15:00 b

/tmp/test3/:
total 16
drwxrwxr-x  2 naveed naveed  4096 Mar  9 15:00 .
drwxrwxrwt 11 root   root   12288 Mar  9 15:00 ..
-rw-rw-r--  1 naveed naveed     0 Mar  9 15:00 c
naveed@ubuntu:~$ sudo unionfs-fuse -o nonempty /tmp/test1=RO:/tmp/test2=RO:/tmp/test3=RO /tmp/test1/
naveed@ubuntu:~$ ls -al /tmp/test1 
ls: cannot access /tmp/test1: Permission denied
naveed@ubuntu:~$ sudo ls -al /tmp/test1 
#nothing shows up here 
Naveed
  • 11
  • 4
  • You can mount them in a completely different directory. – khajvah Mar 09 '15 at 10:46
  • Thats not what i want to do i am looking for a way to do it in the same directory – Naveed Mar 09 '15 at 10:47
  • Take a look at [this](http://superuser.com/questions/200685/what-does-linux-do-with-existing-files-in-a-mount-point) – khajvah Mar 09 '15 at 10:51
  • http://stackoverflow.com/questions/28939431/how-to-mount-additively-on-linux/28939823?noredirect=1#comment46134991_28939823 – Naveed Mar 09 '15 at 10:55
  • the answer is in the above link – Naveed Mar 09 '15 at 10:56
  • When you are using fusefs to mount them, don't try to mount the filesystems on top of an existing directory. You are trying to combine test1,test2,test3 to the destination test1. Instead choose a unused destination. – Zoredache Mar 09 '15 at 15:43

0 Answers0