I wish to mount a volume/filesystem at a non-empty directory, yet still retain access to the directory's contents. Is this possible?
I know that a filesystem can be mounted at a non-empty directory with no issues -- the data will remain when the filesystem is unmounted. What I do want to know is how to access that data while the filesystem is mounted.
I tried creating a hard link to the directory, but even the new directory essentially becomes a second mountpoint. I could verify this by running
ls -i and noting that the
inode for the hard link changed to match the
inode of the mounted volume. Is there something happening at the VFS layer here?
Could I potentially keep some handle on the directory open before mounting and it would remain useful? Any other ideas would be much appreciated.