Empty folder when rclone mount used as external storage of Nextcloud

#1

I’m trying to use the mountpoint of rclone mount as an external storage of Nextcloud. The mountpoint is not empty, but on Nextcloud it is empty.

My exact use-case is a little bit complicated, but here is a simple test-case:

  1. Create files and directories for testing that is accessible by Nextcloud and PHP:
    mkdir testdir
    cd testdir
    mkdir remote local
    touch remote/remote.txt local/local_unmounted.txt
    # create rclone's config file
    echo -e "[test]\ntype = local" > rclone.conf
  2. Add the mountpoint (testdir/local) as an external storage to Nextcloud
  3. Before rclone mount: Test if the content of this external storage is visible in Nextcloud
  4. rclone mount:
    # still inside testdir
    rclone mount test:remote local --config rclone.conf \
    --daemon --allow-non-empty --allow-other \
    --vfs-cache-mode full
  5. You may have to let Nextcloud to do a rescan:
    sudo -u http php <nextcloud's installation directory>/occ files:scan --all
  6. While rclone is mounted: Test again if the content of this external storage is visible in Nextcloud

In my tests on my home computer and on a vps-server, the external storage has one file before rclone is mounted, but it is empty while rclone is mounted (but it should have one file also).

#2

What do you see if you look in the mount directly on the vps-server?

#3

You mean looking with ls -la ...?

Before mounting:
testdir> ls -la local
total 0
drwxr-xr-x 1 root root 38 Mar 21 18:48 .
drwxr-xr-x 1 http http 74 Mar 21 19:02 ..
-rw-r--r-- 1 root root 0 Mar 21 18:48 local_unmounted.txt

After mounting:
testdir> ls -la local
total 0
-rw-r--r-- 1 root root 0 Mar 21 18:48 remote.txt

#4

So it looks like it mounted properly.

I’m not familiar with what external storage for nextcloud needs - does it need a directory structure?

#5

Yes it mounted properly. All commandline and GUI applications I’ve tested work, except Nextcloud.

What is a directory structure? Is that the . and … directories at the beginning of a directory?
If yes, that is not a problem for Nextcloud. I’ve tried mounting other fuse filesystems (encfs, securefs and gocryptfs) and all also have no . and … directories and Nextcloud is able to show the content of their mountpoints.

Is it normal that the disksize is 0?
drwxrwx--- 1 http http 0 Mar 23 16:28 local
drwxrwx--- 1 http http 62 Mar 23 15:13 remote
The other fuse filesystems I’ve tried have a disksize > 0 for the mountpoint when they are mounted.

#6

All the files missing might mean it is a permissions problem. I’d suggest --allow-other but I see you are using that already.

Can you try mounting it directly as the nextcloud user.

Also is nextcloud running in a container or something like that?

A good question… All directories (including the root) appear as 0 size in an rclone mount. No one has reported this as a problem before, but maybe nextcloud is doing something different.

I made this as an experiment which will report all directories to be 512 bytes - can you see if it makes a difference? If it does help, can you try the latest beta too.

https://beta.rclone.org/branch/v1.46.0-103-gd6778c9d-fix-mount-dir-size-beta/ (uploaded in 15-30 mins)

#7

Mounting directly as the nextcloud user (http): empty directory.
Nextcloud is not running in a container.
Using the fix-mount-dir-size-beta version: empty directory.
Using the latest beta version: empty directory.

But there is something interesting:

I’ve been reading Nextcloud’s issues on github and found ls.php for showing the content of a directory:
<?php
echo "Directory: $argv[1]\n";
$content = scandir($argv[1]);
print_r($content);

Doing ls.php on remote shows an output consistent with ls -la:
Directory: remote
Array
(
[0] => .
[1] => ..
[2] => remote.txt
)

Because rclone has mounted remote on local, local should show the same content as remote (except the . and … directories)… but the output of ls.php on local shows an empty directory:
Directory: local
Array
(
)
So, it looks like php’s scandir has issues with rclone.

I looked further on the internet for problems with php’s scandir and found this. It is a bugzilla message where the original poster hinted that a problem may be caused by files having 64bit inodes and php expecting 32bit inodes.

This is interesting because I’m still using a 32bit system.
To see the inodes of rclone’s mountpoint (the local directory), I did ls -lisa:
14131588856014457668 0 -rw-rw---- 1 http http 0 3 Mar 25 17:42 remote.txt
Doing the same on a regular directory (the remote directory):
2912863 0 drwxr-xr-x 1 http http 20 3 Mar 25 21:10 .
2912042 0 drwxr-xr-x 1 http http 208 3 Mar 25 20:55 ..
2912865 0 -rw-r--r-- 1 http http 0 3 Mar 25 17:42 remote.txt

Are those long numbers in rclone’s mountpoint 64bit inodes?

I don’t know how to let rclone or fuse to produce 32bit inodes, but there was a hint in the bugzilla message linked above how to compile php to make it to read 64bit inodes: just adding -D_FILE_OFFSET_BITS=64 to the CFLAGS or CPPFLAGS.

After compiling and installing php, ls.php and Nextcloud both can read the content of rclone’s mountpoint.

For me this problem is solved.
It would be nice if rclone can use 32bit inodes, because then I don’t have to compile php myself.

#8

Just curious. What does rclone version return?

#9

rclone v1.46
- os/arch: linux/386
- go version: go1.11.4

The beta version also works with the self-compiled php:
rclone v1.46.0-103-g8d29d69a-beta
- os/arch: linux/386
- go version: go1.12.1

#10

Yes they are.

Hooray!

rclone leaves the inode generation up to the fuse library it uses. I’m not sure there is an option for 32 bit inodes - I couldn’t see one anyway.

#11

This might be completely wrong but I’ll share my experience. With my plex VPS, if I remount rclone, I have to restart Plex to see these files so maybe close nextcloud. mount your rclone, check it’s working and files are visible and then restart nextcloud.

closed #12

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.