3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

fstabにgoogysでObject Storageのマウントを記述する

Posted at

目的

AWS S3やIBM Cloud Object Storageのバケットはs3fsやgoofysを使うことでファイルシステムのようにOS上にマウントすることができます。今回はgoofysを使い、OSをリブートしても自動でマウントされるよう、fstabに設定します。

手順

goofysのインストール

こちらが参考になります。AWS S3でもIBM Cloud Object Storageの場合でも同じです。

https://dev.classmethod.jp/articles/how-to-use-s3fs-goofys/

/etc/fstabの設定

手動での記述例

goofysは実際にインストールされてるパスを指定してください。環境変数風の表記は実際の値にしてください。

/etc/fstab
/usr/local/bin/goofys#${バケット名} ${マウントパス} fuse _netdev,allow_other,--profile=${プロファイル名} ,--uid=${UID},--gid=${GID},--dir-mode=0750,--file-mode=0640,--stat-cache-ttl=0,--type-cache-ttl=0,--endpoint=s3.private.jp-tok.cloud-object-storage.appdomain.cloud 0 0

Ansibleでの設定例

前述の/etc/fstabと同じ設定が入ります。

- name: Bucket is mounted
  mount:
    path: "{{ マウントパス }}"
    src: /usr/local/bin/goofys#{{ バケット名 }}
    fstype: fuse
    opts: _netdev,allow_other,--profile={{ プロファイル名 }},--uid={{ UID }},--gid={{ GID }},--dir-mode=0750,--file-mode=0640,--stat-cache-ttl=0,--type-cache-ttl=0,--endpoint=s3.private.jp-tok.cloud-object-storage.appdomain.cloud
    state: mounted
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?