To use S3FS as a user (non-root) do this:
s3fs BUCKET-NAME ./bucket \
-o noexec \
-o noatime \
-o auto_unmount \
-o default_permissions \
-o uid="$(id -u)" \
-o gid="$(id -g)" \
-o complement_stat \
-o endpoint='REGION-NAME'To release the mount and shut it down, do this:
fusermount -u ./formbay-mlTo enable cache you want something like:
s3fs BUCKET-NAME ./bucket \
-o noexec \
-o noatime \
-o auto_unmount \
-o default_permissions \
-o uid="$(id -u)" \
-o gid="$(id -g)" \
-o complement_stat \
-o use_cache="$(pwd)/BUCKET-NAME-CACHE" \
-o check_cache_dir_exist \
-o del_cache \
-o enable_noobj_cache \
-o endpoint='REGION-NAME' \
That enables a read and write cache. Primarily it improves read performance.
Note that by default on Linux, mount will mount with the async option set by default. This means write operations be written to the OS page cache first, and only after closing the file descriptor or hitting the page cache boundary will the data be flushed to disk.
If you write a program that writes 1 MiB chunks 1000 times to 1 file. The writes will write to the page cache, then once you are about to close the file, the OS will automatically fsync the data. This is true regardless of whether you use the s3fs cache option or not, because the usage of the page cache is controlled by -o sync or -o async. This means that while you may not be blocked while you write chunks, you will be blocked on the closing of the file descriptor.
Use free -w -h to see your page cache get affected.
Basically when using s3fs you have consider these:
- Your application buffers/cache
- The Linux VFS page cache
- The
s3fscache option which uses another directory on a local disk (this really affects reads, writes get affected because parallel HTTP queries can be used)
Basically s3fs doesn not work like Dropbox where synchronisation is asynchronous, and you read and write files without waiting for the background synchronisation. There's no command for you to tell s3fs to start writing the file while I close the file descriptor and move onto other things. The only to way to get this functionality is by integrating asynchronous IO into your program, by using a thread pool or some sort of reactor pattern or event driven system.
You can use fio to benchmark s3fs and a simple Python program to check the difference between open times, close times and write times.
The default_permissions option is intended to ensure that permissions are followed according to Unix rules. Basically the kernel will check the permissions first, and then the filesystem will check the permissions. By default FUSE won't allow users other than the mounting user to use the filesystem, not even root if root wasn't the mounting user. If you try to check permissions using ls with another user, you will just get ? marks. You have to use allow_other to allow other users to access the filesystem, or you can use allow_root to allow the mounting user and root. Both requires the user_allow_other option in the /etc/fuse.conf. Make sure to set the permissions to chmod 644 for /etc/fuse.conf. Note that without the allow_other or allow_root option, you cannot mount another FUSE filesystem inside the mount. You also need these options to allow you to be able to bind-mount from these directories into a container directory (including using volumes).