19
3
In Linux, is there a way to access files on a mounted filesystem that have been "shadowed" when another file system was mounted over a subdirectory?
E.g.
cd /
mkdir /foo
touch /foo/bar
mount /dev/sda1 /foo
# now, can I still get to /foo/bar on the / filesystem?
The solution of my dreams would not require elevated permissions or be specific to a certain file system, but I'll take whatever scraps I can get without risking a corrupted file system.
+1, I thought that
mount --bind
was the answer. But I wasn't sure. – Dan D. – 2012-02-13T09:38:22.0301+0.95, I completely forgot about binds being nonrecursive by default. However, last time I bindmounted / elsewhere, I could not umount it without rebooting; might have been some GUI component grabbing it though. Have you tested that? – user1686 – 2012-02-13T09:41:11.503
Thanks! I thought about bind mounts for a second, but thought they'd work based on path name rewriting and thus be recursive... – themel – 2012-02-13T09:51:47.020