我创建了Google Cloud Storage Bucket并使用以下方法将其挂载到我的VM:
gcsfuse my-bucket /path/to/mount/point
当我输入df -H
时,它列为已挂载的文件系统。
我有以下问题:
如果我使用GCP Web控制台将文件上传到存储桶,我可以从VM上看到它。如果我尝试创建一个目录,但是从VM到已安装的文件系统mkdir /path/to/mount/point/test
,它说:
mkdir: cannot create directory ‘/path/to/mount/point/test’: Input/output error
我找到了原因。我启用了其他人建议的调试选项。谢谢。不幸的是,日志并没有告诉我太多。幸运的是,我有一个虚拟机,我在那里进行了测试,它工作正常(挂载+读/写到存储桶)。我理解它不是桶侧的权限。 VM创建时使用“允许默认访问”,只读“存储”。我授予对商店的读/写权限。也可以指定“允许对所有Cloud API的完全访问权限”,但如果您不需要,则最好不要授予所有权限。
尝试使用以下命令,它将显示更多信息。
gcsfuse --foreground --debug_gcs --debug_http \
--debug_fuse --debug_invariants \
--key-file=/src/gcloud_service_account.json \
my-bucket /path/to/mount/point
您可能会看到此类错误消息
"code": 403, "message": "Access Not Configured. The API (Cloud Storage JSON API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
如果是,则需要为此实例启用此API。