使用 /etc/fstab 自动挂载多个 s3fs 存储桶

2024-01-06

在 s3fs 指令 wiki 中,我们被告知可以通过输入以下行来自动挂载 s3fs 存储桶:/etc/fstab

s3fs#mybucket /mnt/mybucket fuse    allow_other,use_cache=/tmp,url=https://s3.amazonaws.com 0 0

这对于 1 个存储桶来说效果很好,但是当我尝试通过 2 行将多个存储桶安装到 1 个 EC2 实例上时:

s3fs#mybucket /mnt/mybucket fuse    allow_other,use_cache=/tmp 0 0
s3fs#mybucket2 /mnt/mybucket2 fuse    allow_other,use_cache=/tmp 0 0

只有第二行有效 我尝试将 s3fs 复制到 s3fs2 并:

s3fs#mybucket /mnt/mybucket fuse    allow_other,use_cache=/tmp 0 0
s3fs2#mybucket2 /mnt/mybucket2 fuse    allow_other,use_cache=/tmp 0 0

但这仍然行不通。仅安装第二个:

如何通过 s3fs 自动挂载多个 s3 存储桶/etc/fstab无需手动使用:

s3fs mybucket /mn/mybucket2-ouse_cache=/tmp

也许你的网络没通?

最少的条目 - 只有一个选项(_netdev= 网络“启动”后安装)

<bucket name> <mount point> fuse.s3fs _netdev, 0 0

我运行的是 Ubuntu 16.04,多个安装工作​​正常/etc/fstab.

示例类似于我用于 ftp 图像上传的示例(使用额外的存储桶安装点进行测试):

mybucket1.mydomain.org /mnt/mybucket1 fuse.s3fs _netdev,allow_other,passwd_file=/home/ftpuser/.passwd-aws-s3fs,default_acl=public-read,uid=1001,gid=65534   0 0

mybucket2.mydomain.org /mnt/mybucket2 fuse.s3fs _netdev,allow_other,passwd_file=/home/ftpuser/.passwd-aws-s3fs,default_acl=public-read,uid=1001,gid=65534   0 0

sudo mount -a测试新条目并安装它们(然后进行重新启动测试)。

如果您希望以非 root 身份挂载,请按照上面的说明查看 UID、GID 选项。如果使用熔断器选项,这并不是绝对必要的allow_other因为安装时的权限为“0777”。

警告:Updatedb https://man7.org/linux/man-pages/man1/updatedb.1.html (the locate命令使用此)索引您的系统。您应该检查一下PRUNEFS or PRUNEPATHS in /etc/updatedb.conf涵盖您的 s3fs 文件系统或 s3fs 挂载点。默认设置是“修剪”任何 s3fs 文件系统,但值得检查。否则,如果存储桶中有很多文件,不仅您的系统会变慢,而且您的 AWS 费用也会增加。请参阅常见问题解答链接了解更多信息。

参考:
https://github.com/s3fs-fuse/s3fs-fuse/wiki/Fuse-Over-Amazon https://github.com/s3fs-fuse/s3fs-fuse/wiki/Fuse-Over-Amazon
https://github.com/s3fs-fuse/s3fs-fuse/wiki/FAQ https://github.com/s3fs-fuse/s3fs-fuse/wiki/FAQ

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 /etc/fstab 自动挂载多个 s3fs 存储桶 的相关文章

随机推荐