1

通常每次我连接(startrestart)我的实例时,我都必须手动将 S3 存储桶挂载到它。我使用Goofys(或 s3fs)使用以下命令执行此操作

ubuntu@ip-172-00-23-230:~$ ./go/bin/goofys mybucket my_mountdir

有没有我可以在每次登录我的实例时自动挂载它

4

3 回答 3

2

使用 Linux,您可以使用fstab;自动挂载驱动器。这需要针对不同文件系统的特殊驱动程序。

您应该安装fuse驱动程序并添加 s3 存储桶的条目/etc/fstab

更新

有一个新的开源项目简化了https://github.com/s3fs-fuse/s3fs-fuse

于 2017-02-08T01:13:24.847 回答
2

在 /etc/init.d/mountbucket 中创建一个新脚本

sudo vi /etc/init.d/mountbucket

写下你要执行的行:-

#!/bin/sh
/home/ubuntu/go/bin/goofys mybucket my_mountdir

使其可执行

sudo chmod ugo+x /etc/init.d/mountbucket

更新以在每次系统重新启动时开始

sudo update-rc.d mountbucket defaults
于 2017-02-08T11:22:53.377 回答
1

goofys 的 README 解决了这个用例:https ://github.com/kahing/goofys/

简而言之:

要在启动时挂载 S3 存储桶,请确保为 root 配置了凭据,并且可以将其添加到 /etc/fstab:

goofys#bucket /mnt/mountpoint fuse _netdev,allow_other,--file-mode=0666 0 0

于 2017-02-09T04:54:41.473 回答