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:
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
Add the mountpoint (testdir/local) as an external storage to Nextcloud
Before rclone mount: Test if the content of this external storage is visible in Nextcloud
rclone mount: # still inside testdir rclone mount test:remote local --config rclone.conf \ --daemon --allow-non-empty --allow-other \ --vfs-cache-mode full
You may have to let Nextcloud to do a rescan: sudo -u http php <nextcloud's installation directory>/occ files:scan --all
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).
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
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.
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.
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.
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.