Skip to content

Instantly share code, notes, and snippets.

@alexalouit
Last active December 8, 2021 00:46
Show Gist options
  • Save alexalouit/d202091a4fc75e69d629d0626a22e836 to your computer and use it in GitHub Desktop.
Save alexalouit/d202091a4fc75e69d629d0626a22e836 to your computer and use it in GitHub Desktop.
scaleway s3
# be careful, goofys does not support fsync, software performing check will return an error
$ wget https://github.com/kahing/goofys/releases/latest/download/goofys
$ chmod +x goofys
$ mv goofys /usr/bin/goofys
$ mkdir /root/.aws
$ echo -e "[default]\naws_access_key_id = $accesskey\naws_secret_access_key = $secretkey" > /root/.aws/credentials
$ echo 'goofys#bucket /mnt/bucket-name fuse _netdev,allow_other,--endpoint=https://s3.fr-par.scw.cloud/,--file-mode=0755,--dir-mode=0755,--uid=65534,--gid=65534 0 0' >> /etc/fstab
$ apt install -y s3fs
# compiled version (v1.87+ required for ctime support)
$ apt -y install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
$ git clone https://github.com/s3fs-fuse/s3fs-fuse.git
$ cd s3fs-fuse
$ sed -i 's/MAX_MULTIPART_CNT = 10 /MAX_MULTIPART_CNT = 1 /' src/fdcache.cpp
$ ./autogen.sh
$ ./configure
$ make
$ make install
$ cp ~/s3fs-fuse/src/s3fs /usr/bin/s3fs
$ echo '$accesskey:$secretkey' > /etc/passwd-s3fs
$ chmod 600 /etc/passwd-s3fs
$ echo 's3fs#bucket-name /mnt/bucket-name fuse _netdev,allow_other,use_path_request_style,url=https://s3.fr-par.scw.cloud/,umask=022,uid=65534,gid=65534 0 0' >> /etc/fstab
# advanced usage like dovecot, use use_cache=/tmp/s3-bucket-name
# adjust max_stat_cache_size=10000,stat_cache_expire=60 or max_stat_cache_size=5000,stat_cache_expire=300
$ mount $mountpoint
@see https://www.scaleway.com/en/docs/object-storage-with-s3fs/
# maximum 5gb file: multipart_size=5
# maximum 128gb file: multipart_size=128
# reduce ram usage in cache
# if memory usage grow up, use http endpoint (openssl memory leak?)
$ mv /etc/cron.daily/locate /root/locate.cron.daily
$ systemctl restart cron.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment