rclone: rclone mount helper does not ignore _netdev

The associated forum post URL from https://forum.rclone.org

I do not frequent the forums, I could not find a thread that discusses the issue at hand though.

What is the problem you are having with rclone?

when using rclone as a mount helper (by simlinking to /usr/sbin/mount.rclone as described here

The relevant example in the documentation does not work, specifically it recommend adding an fstab line like the following:

sftp1:subdir /mnt/data rclone rw,noauto,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=writes,config=/etc/rclone.conf,cache_dir=/var/cache/rclone 0 0

this results in rclone failing as it doesn’t seem to handle the leading underscore of _netdev properly. When using this configuration I get an error message:

[root@virt0 ~]# mount /var/lib/external/wasabi/public
2021/11/11 19:22:51 Failed to parse command line: option name can't start with `-` or `_`

the actual line in my fstab:

wasabi-public:stuff.public /var/lib/external/wasabi/public rclone rw,noauto,nofail,_netdev,x-systemd-automount,x-systemd.mount-timeout=30,args2env,vfs_cache_mode=writes,config=/etc/rclone/wasabi/rclone.conf,cache_dir=/var/cache/rclone,env.AWS_SHARED_CREDENTIALS_FILE=/etc/rclone/wasabi/aws/credentials,env.AWS_CONFIG_FILE=/etc/rclone/wasabi/aws/config,allow_other 0 0

changing it to:

wasabi-public:xyz.akdev.public /var/lib/external/wasabi/public rclone rw,noauto,nofail,x-systemd-automount,x-systemd.mount-timeout=30,args2env,vfs_cache_mode=writes,config=/etc/rclone/wasabi/rclone.conf,cache_dir=/var/cache/rclone,env.AWS_SHARED_CREDENTIALS_FILE=/etc/rclone/wasabi/aws/credentials,env.AWS_CONFIG_FILE=/etc/rclone/wasabi/aws/config,allow_other 0 0

allows the volume to be mounted successfully.

What is your rclone version (output from rclone version)

[root@virt0 ~]# rclone --version
rclone v1.57.0
- os/version: centos 8 (64 bit)
- os/kernel: 4.18.0-348.el8.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.2
- go/linking: static
- go/tags: none

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

answered above, centos 8 stream 64bit

Which cloud storage system are you using? (e.g. Google Drive)

wasabi - s3 provider

The command you were trying to run (e.g. rclone copy /tmp remote:tmp)

mount /var/lib/external/wasabi/public

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

Adding vvv to the mount opts did not seem to create more logs than observed above. Seems like the main rclone process is not even getting executed.

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don’t comment if you have no relevant information to add. It’s just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

You may overcome the _netdev issue by using e.g. fuse.rclone in /etc/fstab:

Thank you for insight. This deserves to be documented.

Today I had time to test rclone mount in Linux. This is the proper method for rclone mount on Linux /etc/fstab. Do not use the _netdev in /etc/fstab.

Rclone mount on Linux /etc/fstab

1. Select mount method 1.1 /etc/fstab According to Linux systemd.mount manual the preferred mount method is trough /etc/fstab. $ man systemd.mount

FSTAB Mount units may either be configured via unit files, or via /etc/fstab (see fstab(5) for details). Mounts listed in /etc/fstab will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach. See systemd-fstab-generator(8) for details about the conversion.

1.2 systemd You may also use the systemd. It is not the scope of this guide.

2. Create mountable rclone link 2.1 Select the directory for link There is a document called The Filesystem Hierarchy Standard you should follow: https://refspecs.linuxfoundation.org/fhs.shtml

Deciding what things go into “sbin” directories is simple: if a normal (not a system administrator) user will ever run it directly, then it must be placed in one of the “bin” directories. Ordinary users should not have to place any of the sbin directories in their path.

B/c rclone is installed in the /bin, it is convenient to do the link to /bin. (If you are an administrator you should use /usr/sbin if the rclone mount is not for users to run.) 2.2 Create link rclonefs Rclone manual proposes a symbolic link. Let’s do it:

$ sudo ln -s /bin/rclone /bin/rclonefs
$ ls -ld /bin/rclone*
-rwxr-xr-x. 1 root root 41893888 Dec  3 09:36 /bin/rclone
lrwxrwxrwx. 1 root root       11 Dec  3 10:29 /bin/rclonefs -> /bin/rclone

3. Update /etc/fstab for test Add to the last line in /etc/fstab. Change path /tmp if necessary. remote1:/tmp/test /tmp/test fuse.rclonefs rw,nosuid,nodev,config=/tmp/rclone.conf,args2env,dir-cache-time=10s 0 0

4. Create a testing environment The aim is to gather the command line systemd is executing during the boot (init) phase. Change path /tmp if necessary. 4.1 Remote host: remote1

$ sudo mkdir /tmp/test
$ ls -ald /tmp/test
drwxrwxr-x. 2 root root 17  3.12. 10:13 /tmp/test

4.2 Local host: local1

$ sudo mkdir /tmp/test
$ ls -ld /tmp/test
drwxrwxr-x. 2 root root 17  3.12. 10:13 /tmp/test

4.3 Create rclone.conf

$ cat /tmp/rclone.conf
[remote1]
type = sftp
host = remote1
user = user1
remote = /tmp/test
key_file = /tmp/id_remote1
known_hosts_file = /tmp/known_hosts
md5sum_command = md5sum

5. Run a test 5.1 Mount rclonefs The mount -a uses directives from /etc/fstab $ sudo mount -a 5.2 Check mount $ mount eva1:/tmp/test on /tmp/test type fuse.rclone (rw,nosuid,nodev,relatime,user_id=0,group_id=0) or

$ grep rclone /etc/mtab
eva1:/tmp/test on /tmp/test type fuse.rclone (rw,nosuid,nodev,relatime,user_id=0,group_id=0)

NOTE: in /etc/fstab you have fuse.rclonefs, but in /etc/mtab shows that it is fuse.rclone indeed that is running the mount. 5.3 Server local1 Open a terminal to local1 (ssh local1) and watch the /tmp/test: $ sudo watch ls -l /tmp/test 5.4 Server remote1 Open another terminal to remote1 and do a test file $ sudo cp /etc/groups /tmp/test/testfile.txt 5.5 Wait 5-10 seconds You should see the testfile.txt on the terminal of the server local1.

That’s all folks!

@ncw Ok I will take care of this before 1.58

In the meantime I refreshed labels on pull requests submitted before July 2021. Stale ones are marked by waiting for reply. They can be skipped for now. I posted reminders for people. If they don’t reply in 6 months, I’ll close out the abandoned ones later.

The ones waiting for your review have you assigned. If you don’t have time to review this much code, I will share some burden this December.