accessing files under a mount point (getting at the files that have been obscured by another filesystem mounted on top of them)
This has come up 3 times in the last few days so I thought I'd share it. The situation is that there are files at /var/spool/mqueue that are part of the /var filesystem. But there is also another filesystem mounted at /var/spool/mqueue with it's own files. You want to access the files under the mount but you can't. So, there are two ways around this (in this instance).
Mount /var somewhere else, get the mount device for /var
[me@host ~] $ mount |grep "/var " |sed -e 's/\(.*\) on \/var type.*/\1/'
[me@host ~] $ sudo mkdir /mnt/var
[me@host ~] $ sudo mount /dev/mapper/vg_root/lv_var /mnt/var
The files that were mounted on top of will be accessible again, yay (pretty darn simple no), just don't get confused cause now they'll be in /mnt/var/spool
Use a bind mount to mount /var/spool somewhere else, don't need to figure out the device this way...
[me@host ~] $ sudo mkdir /mnt/spool
[me@host ~] $ sudo mount -t bind -o bind /var/spool /mnt/spool
I prefer this method, the bind mount is also a good clue to the next admin that something funky is going on here...