How to write /etc/fstab entry for –bind mounting?
Posted on In QAHow 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
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
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