Rclone tips and tricks
Root folder missing in Radarr/Sonarr
On Linux (Ubuntu in my case), if Radarr/Sonarr apps are controlled by docker compose
, hooked into an Rclone mount, and started with systemd units, you may sometimes encounter a “Root folder missing” error. This error occurs in Radarr/Sonarr mostly after system reboot. For example, if unattended upgrades are configured, and sometimes they reboot the system.
The problem is: when systemd starts all services after reboot, it does it all at once, and doesn’t wait for the Rclone mount to complete. And docker containers cannot see anything that happened to the mount after they’re started. If mount wasn’t ready at the moment of their start, files and dirs will not appear when they’re running.
You may try to solve it by using systemd After directive, but that will not work, because Rclone mount command does not block until mount is actually completed. So even if you set docker compose
to launch after Rclone mount, it will still launch too early.
The best solution I found for this is to use findmnt
command which is part of util-linux
package.
Add the following to the Service section of the systemd unit file:
ExecStartPre=/bin/sh -c 'until findmnt --mountpoint "/path/to/mount" --mtab >/dev/null; do :; done'
This solution came from this rclone forum post.
B2 Server Side Copy
When using rclone’s move
or copy
(server-side copy) with Backblaze B2 src and dst, here are a couple of useful tips:
- It’s best to set a smaller
--b2-copy-cutoff
, and increase--transfers
to 10-12. B2 is capable of server-side-copying files in chunks, and small cutoff makes the operations a lot faster and more reliable. The transfer bump doesn’t use more RAM either, due to server-sidedness. By default, transfers is 4 and cutoff is 4Gi, which causes B2 to be slow and frequently fail with “503 service unavailable” errors when copying large files. - Set
--b2-hard-delete
when moving files if you actually want to delete originals. Otherwise, rclone hides them, allowing B2 to store the version of the file that can be undeleted. This uses storage.
Here’s my go-to command for this.
rclone move "B2:Path" "B2:OtherPath" -vv --b2-hard-delete --b2-copy-cutoff=200M --transfers=12
B2 Garbage Collection
There is a convenient way to remove all the B2’s old versions of files:
rclone cleanup B2:Path -vv
Code snippets in this post are covered by 0BSD License.