• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Create bind-mounts On CentOS 7.6

  • 01:19 mount --bind /mnt/one /mnt/two
  • 01:48 vim /etc/mtab
  • 02:19 umount -l /mnt/two
6252

Creation of Bind-Mounts On CentOS 7.6

Procedure:

Check the version of CentOS 7.6

[root@linuxhelp1 ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core) 

Navigate to a directory to which you want to create a bind-mount.

[root@linuxhelp1 ~]# cd /mnt

Create two directories where use one as source and two as a bind-mount

[root@linuxhelp1 mnt]# mkdir one two

Change the directory to one and Create files

[root@linuxhelp1 mnt]# cd one
[root@linuxhelp1 one]# touch files{1..6}

Create the bind-mount as follows

[root@linuxhelp1 one]# mount --bind /mnt/one /mnt/two

List the contents In the one directory

[root@linuxhelp1 one]# ls -la
total 0
drwxr-xr-x  2 root root 90 Dec 27 08:47 .
drwxr-xr-x. 4 root root 28 Dec 27 08:47 ..
-rw-r--r--  1 root root  0 Dec 27 08:47 files1
-rw-r--r--  1 root root  0 Dec 27 08:47 files2
-rw-r--r--  1 root root  0 Dec 27 08:47 files3
-rw-r--r--  1 root root  0 Dec 27 08:47 files4
-rw-r--r--  1 root root  0 Dec 27 08:47 files5
-rw-r--r--  1 root root  0 Dec 27 08:47 files6

Verify the bind-mount directory where it has source content

[root@linuxhelp1 one]# cd /mnt/two
[root@linuxhelp1 two]# ls -la
total 0
drwxr-xr-x  2 root root 90 Dec 27 08:47 .
drwxr-xr-x. 4 root root 28 Dec 27 08:47 ..
-rw-r--r--  1 root root  0 Dec 27 08:47 files1
-rw-r--r--  1 root root  0 Dec 27 08:47 files2
-rw-r--r--  1 root root  0 Dec 27 08:47 files3
-rw-r--r--  1 root root  0 Dec 27 08:47 files4
-rw-r--r--  1 root root  0 Dec 27 08:47 files5
-rw-r--r--  1 root root  0 Dec 27 08:47 files6

To check the bind-mounts,navigate to the following location

[root@linuxhelp1 two]# vim /etc/mtab
/dev/sda3 /mnt/two xfs rw,relatime,attr2,inode64,noquota 0 0

Unbind the mount as follows

[root@linuxhelp1 two]# cd ..
[root@linuxhelp1 mnt]# umount -l /mnt/two

Verify the bind-mount directory where the contents of the source directory is removed

[root@linuxhelp1 mnt]# cd two
 [root@linuxhelp1 two]# ls -la
total 0
drwxr-xr-x  2 root root  6 Dec 27 08:47 .
drwxr-xr-x. 4 root root 28 Dec 27 08:47 ..

Verify the bind-mount entry in mtab

[root@linuxhelp1 two]# cat /etc/mtab | tail -2
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/sr0 /run/media/root/CentOS\0407\040x86_64 iso9660 ro,nosuid,nodev,relatime,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500 0 0

From the above result,the bind-mount has been successfully detached.

With this,the method to create a bind-mount on CentOS 7.6 comes to an end

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What does mtab file contain in CentOS?

A

mtab is a file where it contains the currently mounted devices in centos

Q

How to unmount the bind-mount?

A

umount -l to unmount the bind-mount.

Q

What is bind-mount?

A

bind-mount is an alternative way of viewing the original mount point into a different location.

Q

Will removing files in bind-mount effect the original mount point?

A

Yes, removing the files in the bind-mount will affect the original mount point.

Q

How to detach the bind-mounts in CentOS?

A

Using umount,bind-mounts can be easily detached in CentOS

Related Tutorials in How to Create bind-mounts On CentOS 7.6

Related Tutorials in How to Create bind-mounts On CentOS 7.6

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Create bind-mounts On CentOS 7.6

Related Forums in How to Create bind-mounts On CentOS 7.6

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.