• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News 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
{{postValue.id}}

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
{{postCtrl.cmtErrMsg}}

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

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 Jayce ?
What are the types of table used in IPtables

What are the various types of table used in IPtables and how to use that for my server security?

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.