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

1
  • Write a filesystem driver that can handle your broken use case.
    – user143703
    Oct 23, 2017 at 18:47

1 Answer 1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.