1

The following line:

/path1  /path2  posixovl    none    0   0

fails with the error:

/sbin/mount.posixovl: invalid option -- 'o'
Usage: /sbin/mount.posixovl [-F] [-S source] mountpoint [-- fuseoptions]

This is because mount.posixovl uses a non standard mount syntax, and fstab will call it assuming default mount syntax, eg.

mount.posixovl /path1 /path2 -o [whatsoever_/etc/fstab_options]

EDIT #1: Same problem, solved with an uglier hack in this linuxquestions.org Q&A titled: [SOLVED] How to get a fuse-posixovl partition mounted at bootup?

2 Answers 2

2

Thanks vehystrix for sharing your wrapper script. I recently used it to mount a directory inside a users's home. I found two issues I wanted to improve with your script:

  1. renaming the original mont.posixovl binary means it could brake as soon as the packet manager of your distribution installs a new update
  2. the original mount.posixovl is always started as root and it seems to ignore uid= and gid= mount options. This resulted int he filesytem being inaccessible for the user who's home it was mounted to

I slightly changed your script and saved it to /sbin/mount.fuse-posixovl instead (which correlates with the ubuntu package name), so i could use a type fuse-posixovl in fstab to mount it.

Here is the modified version of your script:

#!/bin/bash
# wrapper for mount.posixovl to conform with common mount syntax
# with this wrapper posixovl can be used in fstab
 
# location of the original mount.posixovl
origposixovl="/sbin/mount.posixovl"
 
# gather inputs
while [ $# -gt 0 ]; do
        if [[ "$1" == -* ]]; then
                # var is an input switch
                # we can only use the -o or -F switches
                if [[ "$1" == *F* ]]; then
                        optsF="-F"
                else
                        optsF=""
                fi
                if [[ "$1" == *o* ]]; then
                        shift
                        if [[ "$1" == *uid=* ]]; then
                                runas=$(getent passwd $(echo "$1" | sed -E -e 's/^.*uid=([^,]+)(,.*)?$/\1/') | cut -d: -f1)
                        fi
                        optsfuse="-- -o $1"
                else
                        optsfuse=""
                fi
                shift
        else
                # var is a main argument
                sourcedir="$1"
                shift
                if [[ "$1" != -* ]]; then
                        targetdir="$1"
                        shift
                else
                        targetdir="$sourcedir"
                fi
        fi
done
 
# verify inputs
if [ "$sourcedir" == "" ]; then
        echo "no source specified"
        exit 1
fi
if [ "$targetdir" == "" ]; then
        echo "no target specified"
        exit 1
fi
 
# build mount.posixovl command
if [[ -n "$runas" ]]; then
        su - "${runas}" -c "\"$origposixovl\" $optsF -S \"$sourcedir\" \"$targetdir\" $optsfuse"
else
        "$origposixovl" $optsF -S "$sourcedir" "$targetdir" $optsfuse
fi

and here is an example of a fstab line using it:

/home/myuser/Nextcloud/homebin            /home/myuser/bin fuse-posixovl   uid=1000,gid=1000    0 0
1

I wrote a wrapper for mount.posixovl that enables it to be used with fstab

First, rename /sbin/mount.posixovl to something else, like /sbin/mount.posixovl.orig

Finally, create a new file /sbin/mount.posixovl whith the following contents:

#!/bin/bash
# wrapper for mount.posixovl to conform with common mount syntax
# with this wrapper posixovl can be used in fstab

# location of the original mount.posixovl
origposixovl="/sbin/mount.posixovl.orig"

# gather inputs
while [ $# -gt 0 ]; do
        if [[ "$1" == -* ]]; then
                # var is an input switch
                # we can only use the -o or -F switches
                if [[ "$1" == *F* ]]; then
                        optsF="-F"
                else
                        optsF=""
                fi
                if [[ "$1" == *o* ]]; then
                        shift
                        optsfuse="-- -o $1"
                else
                        optsfuse=""
                fi
                shift
        else
                # var is a main argument
                sourcedir="$1"
                shift
                if [[ "$1" != -* ]]; then
                        targetdir="$1"
                        shift
                else
                        targetdir="$sourcedir"
                fi
        fi
done

# verify inputs
if [ "$sourcedir" == "" ]; then
        echo "no source specified"
        exit 1
fi
if [ "$targetdir" == "" ]; then
        echo "no target specified"
        exit 1
fi

# build mount.posixovl command
"$origposixovl" $optsF -S "$sourcedir" "$targetdir" $optsfuse

Naturally, set the newly created /sbin/mount.posixovl to be executeable (chmod +x /sbin/mount.posixovl)

It is useful mounting posixovl trough fstab

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.