3

Not sure on how to phrase the question easily.

I have a directory /mnt/bla in it MAYBE I have many files and directories.

On top of that directory, I mounted some nfs mount.

Is there a way to check if there are files in the directory underlying the mount without unmounting it?

1 Answers1

6

You can do so using a bind-mount. First you need to create a directory which we use as mount point for the bind-mount:

sudo mkdir /mnt/mymountpoint

(We cannot use /mnt here as suggested in the links in the comments since you have a filesystem mounted on /mnt/bla)

Next step:

sudo mount --bind / /mnt/mymountpoint

Browse to /mnt/mymountpoint/mnt/bla to see what's in the folder. What you see here is the content of /mnt/bla as if nothing were mounted to it.

Move the content of /mnt/mymountpoint/mnt/bla to the location you want or remove the content completely.

Unmount the bind-mount with

sudo umount /mnt/mymountpoint

and remove the mountpoint with

sudo rmdir /mnt/mymountpoint

That's it.

mook765
  • 18,644