如何自动挂载unionfs-fuse文件系统?
我可以运行shell命令:
unionfs-fuse /changedata=RW:/immutedata=RO -o cow /data
这将按照我想要的方式安装文件系统。 现在我需要将它合并到自动挂载器中,以便根据需要重新安装。
我在/etc/auto.misc中尝试过的:
/data -fstype=fuse,cow /changedata=RW:/immutedata=RO
什么automount –debug -f /etc/auto.master在我做ls / data时说:
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
谷歌显示很少。 在合并此文件系统时,手册页相当空。
也许我应该把它放在/ etc / fstab中并要求用户重新安装?
使用autofs自动挂载unionfs
TLDR :在/etc/auto.misc
创建以下条目并将其包含在etc/auto.master
(如下所述)。
data -fstype=fuse,cow,allow_other :unionfs\#/changedata=RW\:/immutedata=RO
额外奖励 :在nfs automounts之上创建unionfs automount(以说明如何正确配置autofs)
使用NFSv4时,在/etc/default/nfs-common
启用IMAPD
NEED_IDMAPD=yes
如果您希望autofs始终为您的挂载创建目录,请在/etc/autofs.conf
启用browse_mode
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
autofs将挂载/etc/auto.nfs
指定的/nfs/
所有文件系统以及/etc/auto.misc
/mnt/
下指定的所有文件系统。
在我的/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
我知道现在回答为时已晚,但在Ubuntu的工作中将以下内容添加到/ etc / fstab中,
/dir/A=RW:/dir/B=RO /dir/my-union fuse.unionfs-fuse allow_other,cow,use_ino 0 0