Rclone mount on Google Drive losing file type during upload

I’m using Sonarr and Radarr, both do the same. Whenever a file is found in the Sabnzbd download folder, it’s copied by their post-processing scripts as file.partial~ to an Rclone mount folder on Google Drive. When its finished copying, the file is renamed without the .partial~.

Any file uploaded this way is detected as a binary file by Drive, and is not playable as a video through their web interface. If I use Rclone copy, its detected as a Video.

I’ve got a debug log of the mounted upload if that’s any use?

What version of rclone are you running?
What does a rclone ls on the file look like? Does that look different from when you use a rclone copy?

Its version 1.46. The output of rclone ls is the same.

If I (using rclone mount and bash commands) copy the file back from GD to the local disk and then copy the file back into place on the mount, the result is a properly detected Video file on the GD website. So the mount seems to work in normal use.

It seems to be related to the mount upload with a temporary name and then the quick rename afterwards.

Not sure it has anything to do with the mount per se as it’s the change of names.

You can replicate the issue with adding any file with some extension and renaming it via the web interface or anything else.

Seems to be not related to rclone at all so you’d have to upload them with the proper extension for it to work.

My example test:

the rename:

So GD detects the file by extension, and the .partial is causing the problem. Thanks for the help.

Has anyone else run into this with Sonarr / Radarr? It seems to be a fairly common use case. Any ideas of a work around?

Edit: I found this bug report, looks like I can’t exclude the .partial~ file at the moment. Any suggestions of another way?

You can use something like unionfs or mergerfs and write locally first and upload at intervals. I don’t normally write to my mount and just upload it later so it’s locally staged a bit.

I’ve been having this issue for quite a while as well.
So, you don’t have to use any workarounds like unionFS or mergerFS. Since v1.40, rclone comes packed with an option --cache-tmp-upload-path, which effectively does the same that @Animosity022 suggested, except rclone monitors and moves the data.
Be sure to specify a path for cache-tmp-upload-path. More about the feature: https://rclone.org/cache/#offline-uploading

That actually doesn’t fix the issue he’s describing as it still writes the partial file first and moves it when completed.

He needs to move the fully completed file with the right extension for it to be parsed properly as a movie. You can’t upload the wrong extension and change it.

Actually it does, because:

  • I don’t experience the problem anymore with that approach;
  • the filename gets changed before rclone attempts to upload it (provided cache-tmp-wait-time is set to a reasonable value; 10m in my case).

Actually, it does if you use that specific configuration, but you didn’t say that in your post.

I think the default 15s for cache-tmp-wait-time is large enough for Sonarr/Radarr to rename the file, but of course that depends on hardware configuration.