How to write /etc/fstab entry for –bind mounting?

How to write /etc/fstab entry for --bind mounting like

mount --bind /home/hadoop/hdfs/store-tmp 
/home/store/tmp

From man 8 mount:

Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is

mount --bind olddir newdir

or shortoption

mount -B olddir newdir

or fstab entry is:

/olddir /newdir none bind

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

2 comments:

  1. Although 4 years have passed. I thought it would be useful for me to paste one of my bind statements.
    Parameter 4 (fs_mntops) has ro as an additional option
    /Development/FSTAB/fstab.git /fstab.git none defaults,ro,bind 0 0

    I wanted to point out that the 4th field may contain optional parameters. In the above example, not shown, the base fstab.git has “default,rw,noatime” settings, and is read/write accessible, whereas the second bind target /fstab.git is read-only mode accessable.

    I have not seen in the man pages

  2. What other parameters can go with the bind parameter,
    I have used ro,defaults,bind and it works
    I have also setup the 5th and 6th parameters to be different from /etc/fstab

Leave a Reply

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