/tmp 中的 s3fs 缓存什么?

What does s3fs cache in /tmp?

我正在使用 s3fs 将大量文件装载到 S3 存储桶。它工作正常,除了我的本地磁盘 space 也增长了很多(/tmp 目录中的内容)。

我的命令是:

$ su ec2-user -c '/usr/bin/s3fs my-bucket-name -o use_cache=/tmp /home/ec2-user/dir'`

我正在使用 use_cache 参数,但实际缓存的是什么?这些文件是否仍需要上传到 s3 并缓存在我的本地机器上?我可以在 upload/mount 期间删除它吗?如果我关闭它(如果它用于其他目的),我的上传速度会更快吗?

来自s3fs wiki(有点难找)

If enabled via "use_cache" option, s3fs automatically maintains a local cache of files in the folder specified by use_cache. Whenever s3fs needs to read or write a file on s3 it first downloads the entire file locally to the folder specified by use_cache and operates on it. When fuse release() is called, s3fs will re-upload the file to s3 if it has been changed. s3fs uses md5 checksums to minimize downloads from s3. Note: this is different from the stat cache (see below).

Local file caching works by calculating and comparing md5 checksums (ETag HTTP header).

The folder specified by use_cache is just a local cache. It can be deleted at any time. s3fs re-builds it on demand. Note: this directory grows unbounded and can fill up a file system dependent upon the bucket and reads to that bucket.