Mount NFS filesystem in two different directories on same system

Q. How do I mount NFS filesystem twice in two different dirs on same Linux client?

NFS Server : nfsserver:/data

Mount to dirs /home/data and /backup

A. You will not able to do that. However mount command has bind option to remount part of the file hierarchy somewhere else.

Procedure

First mount to /home/data
# mount -t nfs4 nfsserver:/data /home/data
Now bind /home/data to /backup
# mount --bind /home/data /backup
# ls /backup /home/data

Read man page of mount command for more information:
$ man mount

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • manpreet singh Apr 3, 2007 @ 6:03

    hello , i want to help for linux commands and working in linux so plz regarding me some helping notes or documents through i m doing mastering thanks for your goodness.

  • Wederik May 29, 2007 @ 21:38

    Mr Singh,
    Try IBM DeveloperWorks LPI Tutorials. An absolute must in my opinion.

  • Steve O Oct 15, 2008 @ 9:50

    Thanks for this – I was getting “stale NFS file handle” because I had mounted the filesystem twice. Clearly I should not have done so!

  • Chase Jan 11, 2010 @ 2:08

    Do you know if there is anything that causes issues with bind when using a CIFS mount?

    I have a few directories that I mount that way, but after a while, it starts listing everything in them (the bind mounted ones) as directories. The original CIFS mount is still fine though.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.