シェルコマンドを実行できます:
unionfs-fuse /changedata=RW:/immutedata=RO -o cow /data
これにより、ファイルシステムが希望どおりにマウントされます。次に、要求に応じて再マウントされるように、これを自動マウント機能に組み込む必要があります。
/etc/auto.misc で試したこと:
/data -fstype=fuse,cow /changedata=RW:/immutedata=RO
ls /data を実行したときに automount --debug -f /etc/auto.master が表示する内容:
handle_packet: type = 5
handle_packet_missing_direct: token 19, name /data, request pid 6063
attempting to mount entry /data
lookup_mount: lookup(file): looking up /data
lookup_mount: lookup(file): /data -> -fstype=fuse,cow /changedata=RW:/immutedata=RO
parse_mount: parse(sun): expanded entry: -fstype=fuse,cow /changedata=RW:/immutedata=RO
parse_mount: parse(sun): gathered options: fstype=fuse,cow
parse_mount: parse(sun): dequote("/changedata=RW:/immutedata=RO") -> /changedata=RW:/immutedata=RO
parse_mapent: parse(sun): gathered options: fstype=fuse,cow
parse(sun): invalid location
dev_ioctl_send_fail: token = 19
failed to mount /data
Google ではほとんど明らかになりません。このファイルシステムの組み込みに関するマニュアル ページはほとんど何も書かれていません。
/etc/fstab に入れて、ユーザーに再マウントするように依頼するべきでしょうか?
答え1
回答するには遅すぎることは承知していますが、Ubuntuの/etc/fstabに以下を追加すると機能します。
/dir/A=RW:/dir/B=RO /dir/my-union fuse.unionfs-fuse allow_other,cow,use_ino 0 0
答え2
autofs による unionfs の自動マウント
要約: に次のエントリを作成し/etc/auto.misc
、それを (以下に概説されているように) に含めますetc/auto.master
。
data -fstype=fuse,cow,allow_other :unionfs\#/changedata=RW\:/immutedata=RO
ボーナス: nfs オートマウントの上に unionfs オートマウントを作成する (autofs を適切に構成する方法を説明するため)
NFSv4を使用する場合は、IMAPDを有効にしてください。/etc/default/nfs-common
NEED_IDMAPD=yes
autofsがマウント用に常にディレクトリを作成するようにしたい場合は、browse_modeを有効にします。/etc/autofs.conf
browse_mode = yes
さて、核心部分です。/etc/auto.master
次の行を追加してください。
# automount all nfs volumes under /nfs and misc filesystems under /mnt
/nfs /etc/auto.nfs
/mnt /etc/auto.misc
/etc/auto.nfs
autofs は、の下で指定されたすべてのファイルシステム/nfs/<mount>
と、/etc/auto.misc
の下で指定されたすべてのファイルシステムをマウントします/mnt/<mount>
。
私の場合、/etc/auto.nfs
次の(例の)エントリがあります。
# FileServer: nfs data configuration
data01 -fstype=nfs4,ro,soft,intr,rsize=8192,wsize=8192,nosuid,tcp,allow_other 192.168.3.100:/mnt/data01
data02 -fstype=nfs4,ro,soft,intr,rsize=8192,wsize=8192,nosuid,tcp,allow_other 192.168.3.100:/mnt/data02
data03 -fstype=nfs4,ro,soft,intr,rsize=8192,wsize=8192,nosuid,tcp,allow_other 192.168.3.100:/mnt/data03
data04 -fstype=nfs4,ro,soft,intr,rsize=8192,wsize=8192,nosuid,tcp,allow_other 192.168.3.100:/mnt/data04
data05 -fstype=nfs4,ro,soft,intr,rsize=8192,wsize=8192,nosuid,tcp,allow_other 192.168.3.100:/mnt/data05
そして/etc/auto.misc
私はunionfsに次のエントリを追加しました
# unionfs mount of all /nfs/data* mounts into /mnt/data
data -fstype=fuse,allow_other,use_ino,ro,noatime :unionfs\#/nfs/data01=RO\:/nfs/data02=RO\:/nfs/data03=RO\:/nfs/data04=RO\:/nfs/data05=RO
すべてのファイルに権限があることを確認してください644
(chown 644 /etc/auto.{nfs,misc}
必要に応じて調整してください)
その後、autofs を有効にしてサービスを再起動できます。
# reload autofs to enable all shares
systemctl enable autofs
systemctl restart autofs
これで、ls /mnt/data