挂载 S3

找了一些,不满意,要么收费,要么闭源,要么不满足需求,如:

  1. https://www.raidrive.com/zh-hant/pricing
  2. https://anystorage.dev/pricing
  3. https://www.v2ex.com/t/1211005
  4. PixelFS https://v2ex.com/t/1112571
  5. https://github.com/lusingander/stu
  6. https://github.com/awsdataarchitect/s3files-mount

免费的当然有,正在尝试 s3fs

  1. https://github.com/s3fs-fuse/s3fs-fuse
  2. rclone

S3FS

安装完成之后,最后提示了一个东西:

==> s3fs-mac
This is the final version that supports FUSE 2.
Further updates require a macOS FUSE 3 implementation.

需要接触 Mac 的硬盘加密,并且启动内核级别拓展:

The system extension required for mounting macFUSE volumes could not be loaded.
Please open the Privacy & Security System Settings and allow loading system software from developer "Benjamin Fleischer". A restart might be required before the system extension can be loaded.
Then try mounting the volume again.

然后在隐私里面相信开发者,最后进行挂载:

s3fs assets /Users/bgzo/cloudflare/r2 -o passwd_file=/Users/bgzo/cloudflare/.passwd-s3fs -o url=https://c816f8c1f713e180f4ed1ca771ed1d4d.r2.cloudflarestorage.com -o ensure_diskfree=0

过程遇到磁盘不足的情况:

s3fs: There is no enough disk space for used as cache(or temporary) directory by s3fs. Requires 47198.208 MB, already has 40262.582 MB.

添加 -o ensure_diskfree=0 跳过校验即可。

最后体验怎么说呢?

最近网络时好时坏,所以总体一般,如果网络环境好一点,延迟低一点,完全是高可用状态,完全可以替代 iCloud、Onedrive。

Rclone

安装:

 curl https://rclone.org/install.sh | sudo bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
100  4734  100  4734    0     0    733      0  0:00:06  0:00:06 --:--:--  1066
 
Password:
 
Archive:  rclone-current-osx-arm64.zip
   creating: tmp_unzip_dir_for_rclone/rclone-v1.74.1-osx-arm64
  inflating: tmp_unzip_dir_for_rclone/rclone-v1.74.1-osx-arm64/git-log.txt  [text]
  inflating: tmp_unzip_dir_for_rclone/rclone-v1.74.1-osx-arm64/rclone  [binary]
  inflating: tmp_unzip_dir_for_rclone/rclone-v1.74.1-osx-arm64/rclone.1  [text]
  inflating: tmp_unzip_dir_for_rclone/rclone-v1.74.1-osx-arm64/README.html  [text]
  inflating: tmp_unzip_dir_for_rclone/rclone-v1.74.1-osx-arm64/README.txt  [text]
 
rclone v1.74.1 has successfully installed.
Now run "rclone config" for setup. Check https://rclone.org/docs/ for more details.

配置:

 rclone config
Option access_key_id.
AWS Access Key ID.
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
access_key_id> xxx
 
Option secret_access_key.
AWS Secret Access Key (password).
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
secret_access_key> xxx
 
Option region.
Region to connect to.
Leave blank if you are using an S3 clone and you don't have a region.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / R2 buckets are automatically distributed across Cloudflare's data centers for low latency.
   \ (auto)
region>
 
Option endpoint.
Endpoint for S3 API.
Required when using an S3 clone.
Enter a value of type string. Press Enter for the default (https://xxx.r2.cloudflarestorage.com).
endpoint>
 
Option bucket_object_lock_enabled.
Enable Object Lock when creating new buckets.
Enter a boolean value (true or false). Press Enter for the default (false).
bucket_object_lock_enabled>
 
Edit advanced config?
y) Yes
n) No (default)
y/n>
 
Configuration complete.
Options:
- type: s3
- provider: Cloudflare
- env_auth: true
- endpoint: https://xxx.r2.cloudflarestorage.com
- access_key_id: xxx
- secret_access_key: xxx
Keep this "cloudflare-r2" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
 
Current remotes:
 
Name                 Type
====                 ====
cloudflare-r2        s3
 
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>

检查:

 rclone lsd cloudflare-r2:
          -1 2026-04-12 01:03:06        -1 assets

挂载

rclone mount cloudflare-r2:assets /Users/bgzo/cloudflare/r2 \
    --vfs-cache-mode writes \
    --daemon \
    --volname "Cloudflare R2 Drive" \
    --file-perms 0777 \
    --dir-perms 0777

比 S3FS 更快,而且本次操作不阻塞 IO,我认为是更好的方案。

References

  1. https://www.v2ex.com/t/911646