ubuntusshservermountsshfs

sshfs - Directories and files not visible after mounting a file system in ubuntu


I have a very strange situation where all the sub-directories and files of a mounted directory have become invisible from the file manager. I have looked here and here, but could not resolve the issue.

Following is the file structure.

GPU server machine

parent_dir:
    sub_dir1
    sub_dir2
     ...
    sub_dirN
    file1
    file2
     ...
    fileN

Local machine

mnt_dir:

The parent_dir is mounted at mnt_dir using sshfs. It all worked fine and all directories were visible from the file manager until yesterday. However, if I mount the directory now, no files or directories are visible.

I have sshed to the GPU machine and noticed that all sub-directories and files are still available, despite not being shown at mnt_dir.

Doing ctrl+H at mnt_dir would not show anything either.

Strangest thing is, if I copy files or directories from the local machine to mnt_dir, they become visible both from file manager and ssh terminal.

How should I get the mounted files/directories visible?

(if it helps, I am using TeamViewer to connect to Local machine from home. But I believe this is irrelevant)


Solution

  • Well, I managed to resolve the issue, again strangely.

    1. Unmount the file system using sudo umount -l /path/to/mnt/mnt_dir
    2. Remove mnt_dir using rm -rf /path/to/mnt/mnt_dir
    3. Recreate mnt_dir using mkdir /path/to/mnt/mnt_dir
    4. mount the file system again to mnt_dir

    Now, all files and directories will be visible from file manager.