windows下安装Rclone并挂载cloud flare R2为本地磁盘

🧰 一、准备工作

✅ 你需要准备:
✅ Cloudflare R2 的 Access Key 和 Secret Key
✅ 你的 R2 Endpoint
✅ R2 存储桶名(如 your_bucket_name)

🪛 二、下载并安装 Rclone(Windows)

打开 Rclone 官网:https://rclone.org/downloads/
下载 rclone-current-windows-amd64.zip
解压到任意目录(如 D:\Program Files\rclone

⚙️ 三、配置 Cloudflare R2

在 PowerShell 中执行以下命令:

./rclone.exe config

按以下步骤配置:

n) New remote
name> r2
Storage> s3
provider> 1 (Amazon Web Services (AWS S3))
env_auth> false
access_key_id> <你的 Access Key>
secret_access_key> <你的 Secret Key>
region> auto
endpoint> abc123456789abcdef.r2.cloudflarestorage.com
location_constraint> (直接按回车)
acl> private
Edit advanced config? (n)
Use this remote? (y)

✔️ 此时你配置了一个名为 r2 的配置文件,指向你的 Cloudflare R2。

🧪 四、测试远程连接

假设你有一个桶(Bucket)名为 your_bucket_name:

./rclone ls r2:your_bucket_name

如果输出文件列表,表示连接成功 ✅

📦 五、挂载 Cloudflare R2 为本地磁盘(如 F:)

✅ 推荐命令:

./rclone mount r2:your_bucket_name F: --cache-dir D:\disk-cache --vfs-cache-mode writes

⚠️ 注意事项:

必须使用管理员权限运行 PowerShell,否则无法挂载盘符!

挂载成功后,打开资源管理器即可看到 F 盘。

🧰 可选:创建一个 mount-r2.ps1 文件用于自动挂载

Start-Process "D:\Program Files\rclone-v1.67.0-windows-amd64\rclone-v1.67.0-windows-amd64\rclone.exe" `
    -ArgumentList @(
        "mount",
        "r2:your_bucket_name",
        "F:",
        "--vfs-cache-mode", "writes",
        "--cache-dir", "D:\disk-cache",
        "--network-mode",
        "--log-level", "INFO"
    ) `
    -WindowStyle Normal

📝 使用方法:

打开记事本,将以上代码复制粘贴进去

另存为 mount-r2.ps1,保存类型选择 所有文件

双击运行,系统会弹出 UAC 提示,请选择“是”(以管理员身份执行)

稍等片刻,资源管理器中会出现 F: 盘,代表你的 R2 桶已成功挂载

© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容