TipsAndTricks/AccessFilesUnderMountpoint

Sometimes a new filesystem many be mounted over a directory already containing files. For example assume a new partition has been mounted to provide a larger /home space, and it is mounted over the original /home directory. The underlying directory structure can be accessed as follows:

mkdir /tmp/mnt
mount --bind / /tmp/mnt

Now you can look in /tmp/mnt/home and access the directory structure there. After you’re done:

cd
umount /tmp/mnt
rmdir /tmp/mnt