See files below / within mount point

Hi,

it happens to me sometimes that there are files in the directory of a mount point. There are not visible as another directory is mounted. How can I access to files without unmounting the mount point? On Linux mount --bind seems to do the trick and I found that mount -t nullfs might be the same but doesn't work for me.

[helmut@BSDHelmut ~]$ mount
/dev/da0p2 on / (ufs, local)
devfs on /dev (devfs)
/dev/da0p13 on /home (ufs, local, nosuid)
/dev/da0p14 on /tmp (ufs, local, nosuid)
/dev/da0p4 on /usr (ufs, local)
/dev/da0p5 on /var (ufs, local, nosuid)
/dev/da0p6 on /var/log (ufs, local, noexec, nosuid)
[helmut@BSDHelmut ~]$ sudo ls -la /var/db/bacula/bacula.sql
-rw------- 1 bacula bacula 7177999772 Mar 30 11:11 /var/db/bacula/bacula.sql
[helmut@BSDHelmut ~]$
[mount on /var/db/bacula]
[helmut@BSDHelmut ~]$ sudo ls -la /var/db/bacula/bacula.sql
ls: /var/db/bacula/bacula.sql: No such file or directory
[helmut@BSDHelmut ~]$ sudo mount -t nullfs /var/db/bacula /mnt/da1/tmp/
[helmut@BSDHelmut ~]$ mount
[...]
/var/db/bacula on /mnt/da1/tmp (nullfs, noexec, nosuid)
[helmut@BSDHelmut ~]$ sudo ls -la /mnt/da1/tmp/bacula.sql
ls: /mnt/da1/tmp/bacula.sql: No such file or directory
[helmut@BSDHelmut ~]$

Thank you!
 
I'm having trouble understanding what you are asking/trying to accomplish.
Are you trying to do something like this:
/dev/da0p2 and /dev/da3p2 contain filesystems.
mount /dev/da0p2 /var/db/bacula <<< /var/db/bacula contains whatever is in /dev/da0p2
mount /dev/da3p2 /var/db/bacula <<< /var/db/bacula now contains whatever is in /dev/da3p2

Are you trying to get /var/db/bacula to contain /dev/da0p2 AND /dev/da3p2?

If yes, then man unionfs
something like this may work:
mount /dev/da0p2 /var/db/bacula
mount -t unionfs /dev/da3p2 /var/db/bacula
 
- Create a file unter /mnt/tmp
- Mount something at /mnt/tmp

How can I make the file visible without unmounting /mnt/tmp?
 
OK, found it out:

[helmut@BSDHelmut ~]$ sudo umount -f /tmp/
[helmut@BSDHelmut ~]$ sudo touch /tmp/test.txt
[helmut@BSDHelmut ~]$ ls /tmp/
test.txt
[helmut@BSDHelmut ~]$ sudo mount -a
[helmut@BSDHelmut ~]$ mount | grep '/tmp'
/dev/da0p14 on /tmp (ufs, local, nosuid)
[helmut@BSDHelmut ~]$ ls /tmp/
.font-unix/ .ICE-unix/ .snap/ .X11-unix/ .XIM-unix/ a2query/ tmux-1001/
[helmut@BSDHelmut ~]$ sudo mkdir /mnt/test
[helmut@BSDHelmut ~]$ sudo mount -t nullfs / /mnt/test
[helmut@BSDHelmut ~]$ ls /mnt/test/tmp/
test.txt
[helmut@BSDHelmut ~]$
 
Back
Top