본문 바로가기

퍼블릭 클라우드

aws ec2 인스턴스(ubuntu)에 goofys를 설치하고 S3 버킷을 마운트하는 방법

728x90

aws ec2 인스턴스(ubuntu)에 goofys를 설치하고 S3 버킷을 마운트하는 방법

테스트 환경

$ lsb_release -d
Description:    Ubuntu 22.04.1 LTS
  • FUSE 설치
    • Goofys는 FUSE를 기반으로 작동하므로 FUSE를 설치해야 합니다.
    • fuse 패키지와 libfuse-dev 패키지 설치
sudo apt-get update
apt-get install -y fuse libfuse-dev

Goofys 설치

Goofys를 Ubuntu 인스턴스에 설치합니다. Goofys는 Go 언어로 작성되었으며, Go 언어가 먼저 설치되어 있어야 합니다.

  • Go 언어를 설치
sudo apt-get install -y golang

Go 언어가 설치되었다면, Goofys를 소스 코드를 사용하여 빌드하고 설치합니다.

더보기

---

Goofys를 소스 코드를 사용하여 빌드하고 설치

go install github.com/kahing/goofys@latest
go get github.com/kahing/goofys

---

  • Goofys 다운로드 및 설치
cd /usr/local/src
wget https://github.com/kahing/goofys/releases/download/v0.24.0/goofys
sudo chmod +x goofys
sudo mv goofys /usr/local/bin/
goofys --version
$ goofys --version
goofys version 0.24.0-45b8d78375af1b24604439d2e60c567654bcdf88
728x90

S3 버킷 마운트

Goofys를 사용하여 S3 버킷을 마운트합니다.

  • 마운트할 디렉토리 생성(마운트 포인트 생성)
mkdir /awsS3
  • goofys를 사용하여 S3 버킷 마운트
sudo goofys my-bucket /awsS3
  • 마운트 해제
umount /awsS3
  • fstab 편집
vim /etc/fstab
#aws s3 buckets
goofys#es-data /awss3/es-data fuse _netdev,allow_other 0 0
  • uid, gid 설정하는 방법
goofys#s3://my-bucket /mnt/s3 fuse _netdev,allow_other,--uid=1000,--gid=1000 0 0
  • 마운트 실행
    • /etc/fstab 파일에 등록된 파일 시스템 정보를 확인하고, 설정되어 있는 파일 시스템을 순차적으로 마운트합니다.
mount -av

 

참고URL

- github : https://github.com/kahing/goofys

 

728x90