使用 autofs 挂载 Google 存储桶

使用 autofs 挂载 Google 存储桶

我正在尝试使用 autofs 按需安装 GCS 存储桶。他们最接近的说明是 SSHFS,如下所示:

mntpoint -fstype=fuse,allow_other :sshfs\#[email protected]\:

按照这个例子我这样做:

mntpoint -fstype=fuse,allow_other :gcsfuse\#my-bucket\:

但这对我不起作用,我不知道如何查看可能出现问题的任何错误信息。这是我的 autofs 配置:

# grep "^#" -v /etc/auto.master
+dir:/etc/auto.master.d
+auto.master
# grep "^#" -v /etc/auto.master.d/mnt.autofs 
/mnt /etc/autofs/auto.mnt
# grep "^#" -v /etc/autofs/auto.mnt 
/- -fstype=fuse,allow_other,r :gcsfuse\#dfci-mev-def-12345-678\:

Mount 通常的工作方式如下:

gcsfuse -o allow_other my-bucket /mnt

GOOGLE_APPLICATION_CREDENTIAL使用环境变量中的谷歌服务帐户凭据文件位置

更新

我将配置中的空格更改为制表符,进行了一些简化并打开了自动挂载的详细输出,我的配置现在如下所示:

# cat /etc/auto.master                                                                                                                                                                                                 
/mnt    /etc/auto.gcsfuse   --timeout=0 --ghost --verbose

# cat /etc/auto.gcsfuse 
dfci-mev-def-12345-678  -fstype=fuse,rw,allow_other :gcsfuse\#dfci-mev-def-12345-678

dfci-mev-def-12345-678 是我的测试桶。我现在可以在 /mnt 中看到它。它看起来像一个文件夹。当我尝试 cd 进入它时,它显示“没有这样的文件或目录”,自动挂载的输出如下所示:

attempting to mount entry /mnt/dfci-mev-def-12345-678
>> gcsfuse takes exactly two arguments. Run `gcsfuse --help` for more info.
mount(generic): failed to mount gcsfuse#dfci-mev-def-12345-678 (type fuse) on /mnt/dfci-mev-def-12345-678
failed to mount /mnt/dfci-mev-def-12345-678
re-reading map for /mnt

更新2

我知道发生了什么事,但我没有解决方案。我的第二组配置是正确的;gcsfuse不喜欢它在存储桶和安装点参数之后的安装选项,我在以下位置向它们开了一张票https://github.com/GoogleCloudPlatform/gcsfuse/issues/216

相关内容