--cache-dir doesn't work for network location

What is the problem you are having with rclone?

--cache-dir doesn't work when using rclone mount as service (using nssm) AND cache folder is on a network mounted drive. Couldn't drive anything to the mount.
--cache-dir works fine when running rclone mount as service but cache path is local drive (ex: C:)
--cache-dir works fine when running rclone mount in CMD for both local and network mounted cache folder situations

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windiws 10 64bit

Which cloud storage system are you using? (eg Google Drive)

Gdrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

2019/10/14 00:56:02 DEBUG : rclone: Version "v1.49.5" starting with parameters ["C:\rclone\rclone.exe" "mount" "--allow-other" "--dir-cache-time" "72h" "--drive-chunk-size" "64M" "--vfs-read-chunk-size" "32M" "--vfs-read-chunk-size-limit" "off" "Gdrive-Amanda-En:" "V:" "--config" "C:\Users\tekkenvm\.config\rclone\rclone.conf" "--vfs-cache-mode" "writes" "--log-file" "C:\log\rclone.log" "--cache-dir" "Y:" "--log-level" "DEBUG"]
2019/10/14 00:56:02 DEBUG : Using config file from "C:\Users\tekkenvm\.config\rclone\rclone.conf"
2019/10/14 00:56:03 DEBUG : Encrypted drive 'Gdrive-Amanda-En:': Mounting on "V:"
2019/10/14 00:56:03 DEBUG : vfs cache root is "Y:vfs\Gdrive-Amanda-En"
2019/10/14 00:56:03 DEBUG : Adding path "vfs/forget" to remote control registry
2019/10/14 00:56:03 DEBUG : Adding path "vfs/refresh" to remote control registry
2019/10/14 00:56:03 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2019/10/14 00:56:03 DEBUG : Encrypted drive 'Gdrive-Amanda-En:': Mounting with options: ["-o" "fsname=Gdrive-Amanda-En:" "-o" "subtype=rclone" "-o" "max_readahead=131072" "-o" "attr_timeout=1" "-o" "atomic_o_trunc" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "-o" "volname=Gdrive-Amanda-En" "-o" "allow_other"]
2019/10/14 00:56:03 DEBUG : Encrypted drive 'Gdrive-Amanda-En:': Init:
2019/10/14 00:56:03 DEBUG : Encrypted drive 'Gdrive-Amanda-En:': >Init:
2019/10/14 00:56:03 DEBUG : /: Statfs:
2019/10/14 00:56:03 DEBUG : /: >Statfs: stat={Bsize:4096 Frsize:4096 Blocks:274877906944 Bfree:274842792824 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Favail:0 Fsid:0 Flag:0 Namemax:255}, errc=0

...

2019/10/14 00:56:44 DEBUG : /System Volume Information: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /System Volume Information: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /EasyStore02: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /EasyStore02: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /: Releasedir: fh=0x0
2019/10/14 00:56:44 DEBUG : /: >Releasedir: errc=0
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /: Opendir:
2019/10/14 00:56:44 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/10/14 00:56:44 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/10/14 00:56:44 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/10/14 00:56:44 DEBUG : /vhui64.exe: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /vhui64.exe: >Getattr: errc=-2
2019/10/14 00:56:44 DEBUG : /: Releasedir: fh=0x0
2019/10/14 00:56:44 DEBUG : /: >Releasedir: errc=0
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /vhui64.exe: Create: flags=0x502, mode=0700
2019/10/14 00:56:44 DEBUG : vhui64.exe: Open: flags=O_RDWR|O_CREATE|O_EXCL
2019/10/14 00:56:44 ERROR : vhui64.exe: File.openRW failed: open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 DEBUG : vhui64.exe: >Open: fd=<nil *RWFileHandle>, err=open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 ERROR : IO error: open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 DEBUG : /vhui64.exe: >Create: errc=-5, fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /: Opendir:
2019/10/14 00:56:44 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/10/14 00:56:44 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/10/14 00:56:44 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/10/14 00:56:44 DEBUG : /vhui64.exe: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /vhui64.exe: >Getattr: errc=-2
2019/10/14 00:56:44 DEBUG : /: Releasedir: fh=0x0
2019/10/14 00:56:44 DEBUG : /: >Releasedir: errc=0
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /vhui64.exe: Create: flags=0x502, mode=0700
2019/10/14 00:56:44 DEBUG : vhui64.exe: Open: flags=O_RDWR|O_CREATE|O_EXCL
2019/10/14 00:56:44 ERROR : vhui64.exe: File.openRW failed: open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 DEBUG : vhui64.exe: >Open: fd=<nil *RWFileHandle>, err=open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 ERROR : IO error: open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 DEBUG : /vhui64.exe: >Create: errc=-5, fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /: Opendir:
2019/10/14 00:56:44 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/10/14 00:56:44 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/10/14 00:56:44 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/10/14 00:56:44 DEBUG : /vhui64.exe: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /vhui64.exe: >Getattr: errc=-2
2019/10/14 00:56:44 DEBUG : /: Releasedir: fh=0x0
2019/10/14 00:56:44 DEBUG : /: >Releasedir: errc=0
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /vhui64.exe: Create: flags=0x502, mode=0700
2019/10/14 00:56:44 DEBUG : vhui64.exe: Open: flags=O_RDWR|O_CREATE|O_EXCL
2019/10/14 00:56:44 ERROR : vhui64.exe: File.openRW failed: open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 DEBUG : vhui64.exe: >Open: fd=<nil *RWFileHandle>, err=open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 ERROR : IO error: open RW handle failed to make cache directory: make cache directory failed: mkdir Y:vfs: The system cannot find the path specified.
2019/10/14 00:56:44 DEBUG : /vhui64.exe: >Create: errc=-5, fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0
2019/10/14 00:56:44 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/10/14 00:56:44 DEBUG : /: >Getattr: errc=0

Seems to be telling you that you don't have permissions to make a folder on "Y" Drive.

You can try:

rclone mkdir Y:vfs

and see if that works.

I agree with Ani. Looks to be a permissions issue.

Keep in mind that it is whatever user-account that is used to launch the rclone process that it inherits it's permissions from. While this is often the same your own user account - it doesn't necessarily have to be in all cases, so keep that in mind. just because it works for you doesn't necessarily mean rclone will have access to it if runs under another account.

@thestigma and @Animosity022
Thank you for your reply.
mkdir works when I manually run it in cmd. I suspect it may not work when running as a service using nssm but not sure how to test it.
If it's indeed a permission issue, how do I specify the correct acc when using nssm? I did try to put the acc credential into nssm "Logon" tab but it didn't help.

Using NSSM I think the default will be to use the SYSTEM account, so make sure that has access to the network share.

Otherwise you can probably set NSSM to use your user instead, which should already have the right permissions. I think that is possible, but I don't think I have used that with NSSM before.

perhaps have nssm run a .cmd batch file and add the following to it.
net share \\servername\sharename /user:username password
rclone.exe ...
or this
net share \\servername\sharename /user:username password /persistent:yes
rclone.exe ...

Hmm, I thought shares were persistent by default. Do you know exactly what that flag does?

now, now, are you just making nice with me...

shares created from net share are not persistent, they do not service a reboot.

Ok, I must have been misremembering. Thanks for clarification. Useful to know for the future and probably will save me some time troubleshooting. Will it even survive on an rclone mounted drive with permanent though?

not sure what you are asking

and i found this at the nssm website

Remember that network drives are configured on a per-user basis and that services, unless explicitly configured otherwise by you, run under the LOCALSYSTEM account. Attempting to configure a network drive, eg *z:* as a service's AppDirectory will probably fail. UNC paths of the form \\server\share are OK.

Hmm... Can you try using a subdirectory on Y: so Y:\cache - I suspect that will work...

another option is to use task scheduler, with the trigger set to begin the task at startup
and then run a .cmd file with

net share \\servername\sharename /user:username password
rclone.exe

i was able to run rclone mount:

  1. user was nt authority\system
  2. --cache-dir set to a network drive as z:
  3. i was able to copy and delete files from the mounted drive x:
  4. no errors in log file.

here is the script

whoami > logfile.txt
net use z: \\servername\sharefolder /user:username password
set flags=--allow-other --dir-cache-time=72h --drive-chunk-size=64M --vfs-read-chunk-size=32M --vfs-read-chunk-size-limit=off --vfs-cache-mode=writes --cache-dir="z:" --log-level=DEBUG
set mountsource=wasabiwest02:thetestfolder
set mountdrive=x:
set logfile=--log-file=logfile.txt
rclone.exe mount %mountsource% %mountdrive% %flags% %logfile%

here is the snippet from the log file:

nt authority\system
2019/10/14 15:51:58 DEBUG : rclone: Version "v1.49.3" starting with parameters ["rclone.exe" "mount" "--allow-other" "--dir-cache-time=72h" "--drive-chunk-size=64M" "--vfs-read-chunk-size=32M" "--vfs-read-chunk-size-limit=off" "--vfs-cache-mode=writes" "--cache-dir=z:" "--log-level=DEBUG" "wasabiwest02:thetestfolder" "x:" "--log-file=logfile.txt"]
2019/10/14 15:51:58 DEBUG : Using RCLONE_CONFIG_PASS password.
2019/10/14 15:51:58 DEBUG : Using config file from "C:\data\rclone\scripts\rclone.conf"
2019/10/14 15:51:58 DEBUG : S3 bucket thetestfolder: Mounting on "x:"
2019/10/14 15:51:58 INFO : S3 bucket thetestfolder: poll-interval is not supported by this remote
2019/10/14 15:51:58 DEBUG : vfs cache root is "z:vfs\wasabiwest02\thetestfolder"
2019/10/14 15:51:58 DEBUG : Adding path "vfs/forget" to remote control registry
2019/10/14 15:51:58 DEBUG : Adding path "vfs/refresh" to remote control registry
2019/10/14 15:51:58 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2019/10/14 15:51:58 DEBUG : S3 bucket thetestfolder: Mounting with options: ["-o" "fsname=wasabiwest02:thetestfolder" "-o" "subtype=rclone" "-o" "max_readahead=131072" "-o" "attr_timeout=1" "-o" "atomic_o_trunc" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "-o" "volname=wasabiwest02 thetestfolder" "-o" "allow_other"]

@asdffdsa Where do I put this script? In a bat file? Also, I'm a little confused. Do we use 'net use' or 'net share' ?
@ncw Thank you but using subdirectory didn't work for me either
@thestigma
After some testings, entering the specific user credential in NSSM works but only for UNC path (\server\rclone\cache) and not for mounted drive (like Z:\rclone).
Looks like UNC path is the only way to go when using NSSM. Is that right?

No that shouldn't matter or have anything to do with NSSM. NSSM just runs a script as a spesific user, not much more.

If rclone now runs under your user account then it should be able to access everything that you can access.

  1. put the .cmd file anywhere you want.
  2. i do not use nssm. as i wrote, i use task scheduler with task to run at startup.
  3. use net share on the server to share the folder. make sure to set the share permissions correctly.
  4. use net use on the client to access the shared folder
  5. as per the link i shared with you, there might be problem using a drive letter with nssm.
  6. i ran rclone.exe as system user and i was able to access the share on windows explorer.

I've used NSSM to mount drive-letters with rclone without any issue - several times. So I don't think this is any real limitation. I do run that process as system though - and other services and scripts that interacts with the drive also as system. (but it seems to work fine for all users with --allow-others)

@tekken007,
i am curious as to why you want the cache on a remote drive versus a local drive?

Nothing special. It's just my VM doesn't have enough space.
Thanks for your help guys

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