Is there any way to mount a folder content inside to another one?

Let's say I have 2 folders with following content;

Folder1       Folder2
  file1       file2

I basically want to make visible all of the content of Folder2 in Folder1. So the new content should be like this;

Folder1       Folder2
  file1       file2

And I also want Folder1 content to be updated when I do any change in Folder2. Let's say I've created file3 in Folder2. I'm expecting to see the new file under both of them.

Folder1       Folder2
  file1       file2
  file2       file3

So the general rules should be;

  • If you create/delete/modify any file under Folder2, it will be also visible under Folder1.
  • If you create/delete/modify any file in Folder 1 (which belongs to Folder2, for example removing file2), those changes will be done in Folder2.
  • User should not see any content of Folder1 under Folder2.

Any solution for that kind of requirement?


  • Why would one want to do this? It looks messy.
    – dr_
    Commented May 3, 2018 at 13:42
  • For upstart conf files. I want to keep /etc/init tidy, so if I can do it, Folder1 will be /etc/init, and Folder2 will be my own service file folder which can reside anywhere in the system. Commented May 3, 2018 at 14:01

2 Answers 2


Try use overlayfs

mount -t overlay overlay Folder1 -o index=off,workdir=$(mktemp -d),upperdir=Folder2,lowerdir=Folder1

All files changes will visible under Folder1 and Folder2. But if you change Folder1 origin files (example file1), changes will visible on Folder2 too.


I'm not aware of anyway to directly do what you're asking, and you would of course encounter issues if file1 existed in both folder1 and folder2.

You could create links from each file/directory under folder2 to folder1, this would require a link per file/directory under folder2. You could create a script to keep the links updated and remove dead links.

If you used hard links then this would all be seamless when doing a directory listing etc.

You could then use inotify to watch folder1 and folder2 to trigger the creation/deletion of the hard links.

  • Creating another controller service is what I'm trying to escape, such as writing script. If I can mount the content of the folder2 into the folder1, and make it permanent, then there won't be any necessity to create a control mechanism. Commented May 4, 2018 at 10:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .