Linux Ubuntu Files behind the mount [closed]

root@host:~# mkdir -p /tmp/test
root@host:~# echo "test" >> /tmp/test/file.txt
root@host:~# mount /dev/xy /tmp/test/

How can I now access file.txt without unmount /dev/xy?

Answer

You may be able to see it by using a bind mount e.g.

mount --bind /tmp /mnt

then

cat /mnt/test/file.txt
test

You have to bind mount the filesystem that contains the original file. In this case /tmp. This may not work with some filesystems e.g. zfs.

Attribution
Source : Link , Question Author : syntax412 , Answer Author : user9517

Leave a Comment