s3fs
s3fs
Note
We recommend using s3fs version 1.84 or higher.
If you experience any issues with s3fs, check the official documentation
s3fs performance depends on the speed of your local disk. Use high-speed disks, especially if you store a lot of small files a few hundred kilobytes in size or smaller. To increase s3fs performance, you can enable caching (via the --use_cache <directory>
key). As the s3fs cache can increase in size without limits, make sure to clear it regularly. You can read more in the s3fs documentation
Getting started
- Create a service account.
- Assign to the service account the roles required for your project, e.g., storage.editor for a bucket (to work with a particular bucket) or a folder (to work with all buckets in this folder). For more information about roles, see Access management with Yandex Identity and Access Management.
- Create a static access key.
Note
A service account is only allowed to view a list of buckets in the folder it was created in.
A service account can perform actions with objects in buckets that are created in folders different from the service account folder. To enable this, assign the service account roles for the appropriate folder or its bucket.
Installation
To install s3fs, follow this guide
Configuration
To configure s3fs, save the key ID and the secret key to the ~/.passwd-s3fs
file in <key_ID>:<secret_key>
format and restrict access to the ~/.passwd-s3fs
file in the following way:
echo <key_ID>:<secret_key> > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs
Mounting a bucket
-
Select the folder where you want to mount your bucket and make sure you have permissions for this operation.
-
Run this command:
s3fs <bucket_name> /mount/<folder_path> -o passwd_file=$HOME/.passwd-s3fs \ -o url=https://storage.yandexcloud.net -o use_path_request_style
To allow other PC users to access the folder, specify the
-o allow_other
option.To set access permissions to the folder you are going to mount the bucket to, specify the
-o mp_umask=<required_permissions>
option.
You can configure bucket mounting at system startup. To do this, open the /etc/fstab
file and add a line in the following format:
s3fs#<bucket_name> /mount/<folder_path> fuse _netdev,allow_other,use_path_request_style,url=https://storage.yandexcloud.net,passwd_file=/home/<username>/.passwd-s3fs 0 0
For descriptions of all s3fs parameters, see the project's wiki page