Skip to content

Feature Request: mount.rclone helper #992

Closed

Description

@gordan-bobic

It would be really handy if there was a mount.rclone wrapper that can be used in /etc/fstab. It would need to accept all the usual paremeters using slightly different syntax, e.g.

rclone --max-read-ahead 4M --read-only --config /path/to/config mount foo:/bar baz

would need to be expressed to the mount helper as:

mount.rclone -o max-read-ahead=4M,ro,config=/path/to/config foo:/bar baz

And, of course, mount.rclone would have to wait until the fs has completed mounting and then go into the background.

Perhaps this could be done by making rclone check whether the binary name it was invoked as is mount.rclone, and if so, alter it's parameter format expectations?

Activity

  1. ncw commented on Jan 9, 2017

    @ncw
    Member

    Nice idea.

    I think this could be achieved by detecting the name of the binary as you say then doing textual manipulation of the -o parameters to make the as per what rclone normally requires.

    note putting rclone in the background is #723

  2. gordan-bobic commented on Jan 13, 2017

    @gordan-bobic
    Author

    This should work for rclonefs helper until the functionality is folded into the rclone binary:

    #!/bin/sh
    
    src=$1
    dst=$2
    
    shift 2
    
    # Process -o parameters
    while getopts :o: opts; do
    	case $opts in
    		o)
    			parms=`echo $OPTARG | sed -e 's/,/ /g'`
    			for parm in $parms; do
    				if [ $parm == "rw"   ]; then continue; fi
                                    if [ $parm == "dev"  ]; then continue; fi
                                    if [ $parm == "suid" ]; then continue; fi
                                    if [ $parm == "exec" ]; then continue; fi
                                    if [ $parm == "noexec" ]; then continue; fi
                                    if [ $parm == "nosuid" ]; then continue; fi
                                    if [ $parm == "nodev" ]; then continue; fi
    				trans="$trans --$parm"
    			done
    			;;
    		\?)
    			echo "Invalid option: -$OPTARG"
    			;;
    	esac
    done
    
    trans="$trans $src $dst"
    
    PATH=$PATH rclone mount $trans &
    sleep 5
    
    

    Then in fstab:

    rclonefs#crypt:/path /mnt/tmp fuse config=/home/user/.rclone.conf,allow-other,default-permissions,read-only,max-read-ahead=16M 0 0

    I have tested this and "it works for me".
    Obviously, change the path to your config appropriately, and the name of the remote (in the above case "crypt" and the paths.

    Important:

    1. rclonefs wrapper has to be in the PATH=/usr/local/bin:/usr/bin. mount is suid and doesn't ignores pre-set PATHs.
    2. Similarly, rclone invocation fails to find fusermount if not invoked with PATH=$PATH explicitly set.
  3. gordan-bobic commented on Jan 21, 2017

    @gordan-bobic
    Author
  4. added this to the v1.37 milestone on Feb 11, 2017
  5. ncw commented on Feb 11, 2017

    @ncw
    Member

    I'll try to do this for the 1.37 release...

    Or unless anyone else wants to have a go?

  6. modified the milestones: v1.37, v1.38 on Jul 19, 2017
  7. modified the milestones: v1.38, v1.39 on Sep 30, 2017
  8. removed this from the v1.39 milestone on Jan 11, 2018
  9. 44 remaining items

  10. added this to the v1.56 milestone on Feb 13, 2021
  11. modified the milestones: v1.56, Soon, v1.57 on Mar 31, 2021
  12. modified the milestones: v1.57, Soon on May 26, 2021
  13. ivandeex commented on Oct 2, 2021

    @ivandeex
    Member
  14. added a commit that references this issue on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions