Announcement

Collapse
No announcement yet.

Unusual bind mount setup and Odd bind mount behavior.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unusual bind mount setup and Odd bind mount behavior.

    HISTORY:

    Ok, since I'm often bored with my computer now that 12.10 is so dang stable; I often look for ways to make it less boring (a.k.a. more complicated).

    I recently installed an SSD but only use it for my installs and not for personal data. Since I have several install I boot to, I prefer to keep /home within each install and keep the lions-share of data on a different drive. Unsatisfied with symlinks to connect each folder from my home to the data drive, I use bind mounts instead as I do on my server.

    The downside to this is, being a multiuser system, one bind mount per folder (8) per user times 5 users is a very large and difficult to manage fstab. Add to this that any time a user is added or removed, I must edit fstab and create or remove the target folders manually. This is not manageable.

    So my solution? I have a script that creates the target folders on initial log in for each user. Along with that, I use /etc/X11/Xstartup and Xreset to bind mount all the folders when then user logs in and un-mount them when they log out. One neat outcome of this method is I have a single local Public folder that gets mounted for every user, thus providing a very simple way to share something. Additionally, it adds a small level of file security since none of a users personal data is available unless they are logged in.

    Please keep in mind this is more of a mental exercise in automating desktop functions than it is a real-word requirement. As I said at the outset - I'm a bit bored with Kubuntu so I must create my own challenges.

    THE ISSUE:

    All the above works well except one small thing. One of the bind mounts is to a NFS share mount and it won't mount at log in. The mount is listed in the output of "mount" but it's not actually connected the the share mount location. I have to manually un-mount and then re-mount it after log-in. I tried a sleep to see if it was a delay in the NFS share becoming available, but that had no effect.

    In theory, the NFS mount is in fstab so it should be mounted at boot time. The bind mount command is executed at log into the desktop so should mount just fine.

    Any ideas where to start looking?

    Please Read Me

    #2
    Is the NFS share on a different machine? Is there a network connect issue preventing it?
    --
    Intocabile

    Comment


      #3
      The NFS mount is on the server. The NFS share is mounted without issue. However, the bind mount to it does not work as expected.

      Please Read Me

      Comment


        #4
        Network file systems can be delayed in their mounting until the network is brought up by adding "_netdev" as an option in /etc/fstab... is the bind mount happening before the actual mount? If so it might point to the folder under the NFS share when it finally gets mounted (resulting in an empty directory showing). Note that the network interface might be brought up by NetworkManager after login, so could delay the mounting of the NFS share... might be worth trying to figure out when the network gets brought up (possibly by upstart?).

        How long did you try the sleep for?

        Comment


          #5
          I thought of the mount delay re the _netdev option. I need to test it specifically.

          The weird thing is the bind mount shows in the mount list but no files in the folder. One would think that a refresh would solve it, but it requires umount then mount to get the folders to show up.

          I don't use network manager to control my network connection - I have dual ethernet ports on both the server and client and use bonding and network manager doesn't support that configuration AFAIK.

          Please Read Me

          Comment


            #6
            The mount being empty sounds like it is being mounted underneath the nfs mount... I have had a similar issue before (accidently copied the data to a mointpoint before mounting, then on reboot the data `disappeared ` until I unmounted the partition)

            What I think is happening is this:

            /mnt/mountpoint is empty (as it is a mount point so should be)

            You bind mount it to /mnt/bindpoint

            So /mnt/bindpoint points to the empty folder in /mnt/mountpoint

            You then mount the nfs share over /mnt/mountpoint, but the bind mount points to the same location as before (the empty folder under that now exists under the nfs share, not the nfs share on the mountpoint).

            I bet if you create a file in the /mnt/bindmount it will be in /mnt/mountpoint when you unmount the nfs share (though I don't know for sure what will happen as this is not a normal state for linux to be in).

            So I now think of mounts as being laid `on top` of the folders then are mounted on, suppressing everything underneath them (not sure how accurate this actually is).

            Comment


              #7
              Yeah, I think thats generally what's happening, but I can't figure out why. AFAIK, at boot time, fstab and networking are processed before log in but maybe not. I'm on a wired network so it's not being causing by wireless delay.

              Maybe the solution will be to re-configure how I'm doing all this, but it was a fun experiment.

              Please Read Me

              Comment


                #8
                You could try adding a check in the mount script to delay until it can access the share...

                Or add debug statements (echo stuff &>> /tmp/file.log) to the script to see what state things are at when the script is running

                ie "echo mount &>> /tmp/mount.log"

                Comment


                  #9
                  I'm barking up an old thread here, but this issue went away with 13.04

                  Please Read Me

                  Comment

                  Working...
                  X