Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

bind mount refuses to work - but no errors anywhere ?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Jethro_UK
Posts: 37
Joined: 2014-08-12 09:31

bind mount refuses to work - but no errors anywhere ?

#1 Post by Jethro_UK »

I have a directory mounted as /dev/md2/MyDir. All is great with that.

I want to bind the directory /var/lib/MyDir to it, so that when any application goes to look inside /var/lib/MyDir they actually get to see /mnt/md2/MyDir

apparently all I need to do (as root) is mount --bind /var/lib/MyDir /mnt/md2/MyDir and all will work

I issue the command, no errors. If I add "-v" then I get the message "mount /var/lib/MyDir bound on /mnt/md2/MyDir
mount -l shows the mount as existing.

But in reality it doesn't exist, as drilling into /var/lib/MrDir doesn't reveal what is inside /mnt/md2/MyDir

So why is mount not working - and why does it think it is ?

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 504
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: bind mount refuses to work - but no errors anywhere ?

#2 Post by Bloom »

You can only use the bind option for an existing directory, not for devices. Think of mount --bind as something like a shortcut.
So you need to remove that option for /dev/md2/MyDir and instead specify the necessary options for the filesystem used on the RAID volume.

Jethro_UK
Posts: 37
Joined: 2014-08-12 09:31

Re: bind mount refuses to work - but no errors anywhere ?

#3 Post by Jethro_UK »

Bloom wrote:You can only use the bind option for an existing directory, not for devices. Think of mount --bind as something like a shortcut.
So you need to remove that option for /dev/md2/MyDir and instead specify the necessary options for the filesystem used on the RAID volume.

But they are both existing directories. I'm not trying to link a device, but a directory (on a device).

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 504
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: bind mount refuses to work - but no errors anywhere ?

#4 Post by Bloom »

Ah, okay.
The arguments of mount are:

Code: Select all

mount [options] source target
So if you want visitors to /var/lib/MyDir to in fact see the contents of /mnt/md2/MyDir, the first is the target and the second is the source.
You had them reversed. It should be:

Code: Select all

mount --bind /mnt/md2/MyDir  /var/lib/MyDir
Unless you plan to put that in your /etc/fstab, you could do the same with a softlink:

Code: Select all

ln -s /mnt/md2/MyDir /var/lib/MyDir

Jethro_UK
Posts: 37
Joined: 2014-08-12 09:31

Re: bind mount refuses to work - but no errors anywhere ?

#5 Post by Jethro_UK »

Ah, facepalm moment I think !

Thanks for your patience !

Post Reply