LoginSignup
0
3

More than 1 year has passed since last update.

Ubuntu20.04でgoofysを使ってS3をマウントする

Last updated at Posted at 2021-07-03

はじめに

Gooofysは、AWS S3のバケットをPOSIX互換環境にマウントするためのGo言語のライブラリである。

本記事では、このgoofysをUbuntu20.04にインストールしてS3をマウントするまでの手順を示す。

環境

動作環境は以下の通り。

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ aws --version
aws-cli/2.2.1 Python/3.8.8 Linux/5.4.0-77-generic exe/x86_64.ubuntu.20 prompt/off

手順

goofysの公式サイトから pre-built binaries をダウンロードする。

なお、公式手順のgoコマンドでインストールする方法は、本記事執筆時点(7/2)では以下の通りエラーになる。

go-getで失敗
$ go get github.com/kahing/goofys
go: finding github.com/kardianos/osext latest
go: finding github.com/jacobsa/fuse latest
go: finding golang.org/x/sys latest
go: finding github.com/StackExchange/wmi latest
# github.com/kahing/goofys/api/common
go/pkg/mod/github.com/kahing/goofys@v0.24.0/api/common/conf_azure.go:272:34: accountsRes.Value undefined (type storage.AccountListResultPage has no field or method Value)
go/pkg/mod/github.com/kahing/goofys@v0.24.0/api/common/conf_azure.go:373:35: not enough arguments in call to client.ListKeys
    have (context.Context, string, string)
    want (context.Context, string, string, storage.ListKeyExpand)

ダウンロードしたpre-build binariesを適当なフォルダに格納し、rootユーザで実行権限をつけ、パスを通す。

$ ll /opt/goofys/goofys 
-rwxrwxr-x 1 root root 23M  7月  3 07:09 /opt/goofys/goofys*

マウントポイントのフォルダを作成し、S3のバケット名を指定して、マウントする。

$ mkdir -p /mnt/point/
$ goofys bucket_name /mnt/point/

マウントポイントの"/mnt/point"に適当なファイル"directory/to/file.tar.gz"をコピペして、数秒待つと、S3にアップロードされるr。

アップロードされたことはaws-cliのコマンドで確認できる。

$ aws s3 ls s3://bucket_name --recursive --human-readable --summarize
2021-07-03 08:03:25   49.7 MiB directory/to/file.tar.gz
Total Objects: 8
   Total Size: 49.7 MiB

参考文献

0
3
1

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
0
3