-2
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?

syntax412
  • 9
  • 3

1 Answers1

2

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.

user9517
  • 115,471
  • 20
  • 215
  • 297