Mount point bind issues

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Mount point bind issues
# 1  
Old 03-23-2017
Mount point bind issues

Hi ALL

I am unable to do mount bind to connect new storage

Once I run the below commands both file systems were empty

Code:
Code:
mount --bind /prod/OpenCSS /var/lib/test


Code:
Code:
echo "/prod/OpenCSS /var/lib/pgsql bind bind 0 0" >> /etc/fstab

Moderator's Comments:
Mod Comment Please use code tags for code and data

Last edited by Scrutinizer; 03-23-2017 at 03:06 PM.. Reason: code tags
# 2  
Old 03-23-2017
Hi,

Your syntax is basically correct, as far as I can tell. Here's the results of a test on my own system, running Ubuntu 16.04 x86_64:

Code:
$ pwd
/home/unixforum/271681
$ ls
path1  path2
$ ls path1
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ ls path2
$ sudo /bin/mount --bind /home/unixforum/271681/path1 /home/unixforum/271681/path2
$ ls path1
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ ls path2
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ mount | grep unixforum
/dev/sda2 on /home/unixforum/271681/path2 type ext4 (rw,relatime,errors=remount-ro,data=ordered)
$ sudo /bin/umount /home/unixforum/271681/path2
$ ls path1
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ ls path2
$

Asf for the fstab entry, the syntax seems fine here too. Again, a test, this time doing the mounting with an fstab entry.

Code:
$ tail -1 /etc/fstab
/home/unixforum/271681/path1    /home/unixforum/271681/path2    bind    bind    0 0
$ ls path1
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ ls path2
$ sudo /bin/mount /home/unixforum/271681/path2
$ ls path1
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ ls path2
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ sudo /bin/umount /home/unixforum/271681/path2
$ ls path1
doc1.pdf  file1.txt  image1.jpeg  sheet1.xlsx
$ ls path2
$

So I'm not sure why this isn't working on your own system. Certiainly on my own local box, this syntax works fine, and I didn't really have to change anything you were doing.
This User Gave Thanks to drysdalk For This Post:
# 3  
Old 03-23-2017
Thank you again

Yes I am able to replicate successfully on other server

this server is failing

so you think there is some issue with the existing mount point / file systems?
# 4  
Old 03-23-2017
Hi,

Just to check something: the order in a bind mount is source first, then destination. So in my above examples, it was the content of path1 that I wanted to show up under path2. Is it the case that you want all the content currently in /prod/OpenCSS to show up underneath /var/lib/test and/or /var/lib/pgsql, or it is the PostgreSQL content you want to appear underneath the other directory ?

Also, if you look at the content of both directories before doing the bind mount, are either of them empty to begin with ?
This User Gave Thanks to drysdalk For This Post:
# 5  
Old 03-23-2017
got it


finally I made same mistake

mount --bind /some/where /else/where
makes /else/where a mount point under which the contents of /some/where are visible.
# 6  
Old 03-23-2017
Hi,

Great, glad you got that sorted. One last thing that may disappoint, however. If you're doing this because you're hoping to basically add the free space of the /prod/OpenCSS filesystem to the existing /var/lib/pgsql filesystem...well, then you're out of luck.

That's not how bind mounts work, or what they're for. They're purely for providing an alternative path to access the same content in multiple places, and nothing else. The free space you'll see will be that of the original filesystem, since all the calls are being routed through to the original filesystem - the new one (in your scenario) isn't actually going to be used at all.

For example, watch what happens if I do a bind mount of my /boot filesystem to a new directory, /mnt/misc:

Code:
$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /boot
$ df -h /mnt/misc
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       225G  132G   82G  62% /
$ sudo /bin/mount --bind /boot /mnt/misc
$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /boot
$ df -h /mnt/misc
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /mnt/misc
$ sudo /bin/umount /mnt/misc
$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /boot
$ df -h /mnt/misc
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       225G  132G   82G  62% /
$

So as you can see, the disc space and all other properties of the bind mount destination are the same as the source, since in reality all you're doing is providing an additional path for accessing the source, and nothing more.

Hope this helps.
This User Gave Thanks to drysdalk For This Post:
# 7  
Old 03-23-2017
Thank you Drysdalk

I did moved data to new point and then implemented bind mount to make use of the space ...

---------- Post updated at 04:58 PM ---------- Previous update was at 04:57 PM ----------

Smilie
Quote:
Originally Posted by drysdalk
Hi,

Great, glad you got that sorted. One last thing that may disappoint, however. If you're doing this because you're hoping to basically add the free space of the /prod/OpenCSS filesystem to the existing /var/lib/pgsql filesystem...well, then you're out of luck.

That's not how bind mounts work, or what they're for. They're purely for providing an alternative path to access the same content in multiple places, and nothing else. The free space you'll see will be that of the original filesystem, since all the calls are being routed through to the original filesystem - the new one (in your scenario) isn't actually going to be used at all.

For example, watch what happens if I do a bind mount of my /boot filesystem to a new directory, /mnt/misc:

Code:
$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /boot
$ df -h /mnt/misc
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       225G  132G   82G  62% /
$ sudo /bin/mount --bind /boot /mnt/misc
$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /boot
$ df -h /mnt/misc
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /mnt/misc
$ sudo /bin/umount /mnt/misc
$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       240M  110M  114M  49% /boot
$ df -h /mnt/misc
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       225G  132G   82G  62% /
$

So as you can see, the disc space and all other properties of the bind mount destination are the same as the source, since in reality all you're doing is providing an additional path for accessing the source, and nothing more.

Hope this helps.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to create a new mount point with 600GB and add 350 GBexisting mount point? IN AIX

How to create a new mount point with 600GB and add 350 GBexisting mount point Best if there step that i can follow or execute before i mount or add diskspace IN AIX Thanks (2 Replies)
Discussion started by: Thilagarajan
2 Replies

2. UNIX for Beginners Questions & Answers

Can we have 2 mount point under the same name but at different directory?

guys i would like to know can we have 2 mount point which is same name but on different directory? (3 Replies)
Discussion started by: leecopper
3 Replies

3. Emergency UNIX and Linux Support

Help with autos and mount bind

I have a sftp server running on Centos 5.10. It servers as upload/download interface for three users who basically are chrooted to three different locations. User A -- > /home/REGIONA/ User B -- > /home/REGIONB/ User C -- > /home/REGIONC/ The users run certain application procedures on... (4 Replies)
Discussion started by: maverick_here
4 Replies

4. Red Hat

Linux Bind mount issues.

Hi All, we have an issue in bind mounting LINUX. we are able to see the bound mounts in mount command and df -h <file system name> but they are not visible in normal df -h command. all these mounts are local mounts. we have a /xyz is mount and abc is a directory in /xyz ( /xyz/abc ) ... (1 Reply)
Discussion started by: Naveen.6025
1 Replies

5. UNIX for Dummies Questions & Answers

mount --bind

I read it create hard link but I want to be sure, what does this command do exactly? Thank in advance. (1 Reply)
Discussion started by: programAngel
1 Replies

6. Solaris

Mount Point Sorting?

Dear Gurus, Could it be possible to have the output of df -k sorted? The df -k output messed up after recent power trip. Also, is there any folders that I should look into to reduce the root size (other than /var/adm and /var/crash) after server crash? Many thanks in advance. ... (2 Replies)
Discussion started by: honmin
2 Replies

7. AIX

Creating a new mount point

Hello, I have an AIX Oracle database server that I need to create a new filesystem/mount where I can create a new ORacle home to install 11g on. What are the needed steps to create this? There are mounts for Oracle 9i and 10g already. Thank you. - David (7 Replies)
Discussion started by: dkranes
7 Replies

8. UNIX for Advanced & Expert Users

mount point lists

is there any command to know the list of mount points in a server.i need only the mount point lists.i tried using df but it was not helpful.i am using Solaris (1 Reply)
Discussion started by: dr46014
1 Replies

9. UNIX for Dummies Questions & Answers

auto mount point

hi can i know what is the command to create auto mount point in my unix server? is there any directory which i have to go? (1 Reply)
Discussion started by: legato
1 Replies

10. UNIX for Dummies Questions & Answers

mount point

hi people, I'm trying to create a mount point, but am having no sucess at all, with the following: mount -F ufs /dev/dsk/diskname /newdirectory but i keep getting - mount-point /newdirectory doesn't exist. What am i doing wrong/missing? Thanks Rc (1 Reply)
Discussion started by: colesy
1 Replies
Login or Register to Ask a Question