Accessing files obscured by filesystem mounted at non-empty directory

3

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.

Sedate Alien

Posted 2010-10-13T10:28:36.833

Reputation: 393

1Search for "union mount" - I think that's what you're trying to do. – pjc50 – 2012-02-20T16:45:23.530

Answers

0

What you may be looking for is a way to do Linux's mount --bind on OS X. You can try bindfs and see if it works for you.

Paused until further notice.

Posted 2010-10-13T10:28:36.833

Reputation: 86 075