fstabを使用したposixovlマウント

fstabを使用したposixovlマウント

次の行:

/path1  /path2  posixovl    none    0   0

エラーが原因で失敗します。

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

これは、mount.posixovl非標準のインストール構文が使用され、デフォルトのfstabインストール構文がそれを呼び出すと仮定するためです。

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

編集#1: 同じ問題は、このlinuxquestions.org Q&Aで次のような醜いハッキングで解決されました。[解決済み] 起動時に Fuse-posixovl パーティションをどのようにインストールしますか?

ベストアンサー1

ラッパースクリプトを共有してくれたvehystrixに感謝します。私は最近、これをユーザーの家にディレクトリをマウントするために使用しました。あなたのスクリプトで改善したい2つの問題を見つけました。

  1. ネイティブmont.posixovlバイナリの名前を変更すると、ディストリビューションのパッケージマネージャが新しいアップデートをインストールすると実行が停止することがあります。
  2. 元のバージョンはmount.posixovl常にルートで始まり、インストールオプションを無視しているようuid=ですgid=。これにより、ファイルシステムをマウントしたユーザーがファイルシステムにアクセスできなくなります。

スクリプトを少し変更して(Ubuntuパッケージ名に基づいて)に保存して、/sbin/mount.fuse-posixovlfstabの型を使用してfuse-posixovlインストールできました。

以下はスクリプトの修正版です。

#!/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

以下は、これを使用するfstab行の例です。

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

おすすめ記事