Consider i have files in /mnt i am mounting an nfs share to /mnt. After that i can find the nfs share contents in /mnt. But the preexisted files are missing. Is there any way to access both the preexisting and mounted files simultaneously?


Strictly speaking: No you cannot see Filesystem contents for lower mounted filesystems.

Nevertheless there are some solutions to the problems. The few that spring to mind being:

  • unionfs - takes few FS and presents a merged view of them
  • aufs - same thing as unionfs but more mature

Best practice is NOT to mount multiple filesystems on one mountpoint. If it is required to be accessible under a single tree either make directories inside the mountpoint and mount it there or mount them one under the other e.g. /mnt/nfs/< nfs share files >


I don't think you can. (see EDIT) The easiest way to do this is to create a subdirectory in /mnt and then mount the nfs share in the subdirectory. If, for example, you have the file1.txt and file2.txt in /mnt and you have file3.txt and file4.txt in the nfs share.

# mkdir /mnt/nfs
# mount <nfs-share> /mnt/nfs


# ls /mnt
file1.txt file2.txt nfs
# ls /mnt/nfs
file3.txt file4.txt

EDIT: This was the closest thing I could find

What does Linux do with existing files in a mount point?

The general idea is to bind mount the parent directory of /mnt (i.e. /) so that the actual contents of /mnt can be accessed.

# mkdir /fakeroot
# mount --bind / /fakeroot
# mount <nfs-share> /mnt


# ls /mnt
file3.txt file4.txt
# ls /fakeroot/mnt
file1.txt file2.txt

If you want to see both the files in /mnt and the files in the nfs share in /mnt you will probably need a union filesystem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.