四個錯誤,同一個前提
rclone mount 其實不是 rclone 的功能,而是 rclone 驅動的檔案系統驅動程式的功能。下面每個錯誤都是那一層在拒絕合作。這是你真正會遇到的四個,照被回報時的原樣引用。
text
Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount3": executable file not found in $PATHtext
panic: cgofuse: cannot find winfsptext
Cannot create WinFsp-FUSE file system: mount point in use.
Fatal error: failed to mount FUSE fs: mount stopped before calling Init: mount failedtext
NOTICE: mount helper error: fusermount3: mount failed: Permission denied
CRITICAL: Fatal error: failed to mount FUSE fs: fusermount: exit status 1| 錯誤 | 平台 | 原因 | 處理 |
|---|---|---|---|
fusermount3 ... not found in $PATH | Linux | 沒裝 FUSE 3 使用者空間工具 | 安裝 fuse3 套件 |
mount helper error: fusermount3: mount failed: Permission denied | Linux | 較新 Ubuntu 的 AppArmor 限制 | sudo aa-disable /usr/bin/fusermount3 |
cgofuse: cannot find winfsp | Windows | 沒裝 WinFsp | 安裝 WinFsp |
mount point in use | Windows | 目標資料夾已存在 | 刪掉它,或換一個空閒磁碟機代號 |
沒有 /dev/fuse,或什麼都沒掛上 | macOS | 缺 macFUSE 或 FUSE-T | 裝一個,並核准擴充功能 |
| 掛上了,但寫入時卡住或報錯 | 全平台 | VFS 快取模式不足以應付這種用法 | --vfs-cache-mode writes 或 full |
Linux:先裝工具,再看 AppArmor
第一個錯誤就是字面意思。rclone 會去呼叫 FUSE 的掛載輔助程式,在 FUSE 3 的系統上那個執行檔叫 fusermount3。精簡容器與一體機發行版常常缺它,缺了的話 rclone 這邊設定什麼都沒意義。
sh
which fusermount fusermount3
sudo apt install fuse3 # Debian, Ubuntu
sudo dnf install fuse3 # Fedora, RHEL第二個是較新的症狀,rclone 的掛載文件自己點名了它:「On newer versions of Ubuntu, you may encounter the following error when running rclone mount」——緊接著就是上面那段 mount helper error。文件給出的原因是 AppArmor:「This may be due to newer Apparmor restrictions, which can be disabled with sudo aa-disable /usr/bin/fusermount3 (you may need to sudo apt install apparmor-utils beforehand).」
卸載用的是同一個輔助程式,這點值得記住,因為一個半死的掛載點會在下一次給你更莫名的錯誤:
sh
fusermount -u /path/to/local/mount
fusermount3 -u /path/to/local/mountWindows:WinFsp 不是選配
rclone 的文件毫不含糊:「To run rclone mount on Windows, you will need to download and install WinFsp. WinFsp is an open-source Windows File System Proxy which makes it easy to write user space file systems for Windows. It provides a FUSE emulation layer which rclone uses in combination with cgofuse.」
沒裝它,你拿到的就是 panic: cgofuse: cannot find winfsp 這段堆疊——之所以是 panic 而不是客氣的提示,是因為 FUSE 層連初始化都做不到。WinFsp 自我介紹為「system software that provides runtime and development support for custom file systems on Windows computers」,並說明它相當於 UNIX 系上的 FUSE。裝好,必要時重開機,再試一次。
Windows 端的第二個錯誤性質不同。Cannot create WinFsp-FUSE file system: mount point in use. 通常代表你指定的資料夾已經存在。回報者自己兩分鐘就解決了:「All I have to do is make sure that the mount folder does not exist. I already created the folder hence the error.」用一個真正空閒的磁碟機代號同樣有效:
powershell
rclone mount remote: X: --vfs-cache-mode writes
rclone mount remote: C:\path\parent\mount --vfs-cache-mode writesmacOS:兩個驅動程式,選一個
在 macOS 上 rclone 給了三個選項,並把取捨寫得很準確:「Mounting on macOS can be done either via built-in NFS server, macFUSE (also known as osxfuse) or FUSE-T. macFUSE is a traditional FUSE driver utilizing a macOS kernel extension (kext). FUSE-T is an alternative FUSE system which 'mounts' via an NFSv4 local server.」
這一句基本就能決定選誰。macFUSE 代表核心擴充功能,在目前的 macOS 上代表要在系統設定裡核准,而且通常要重開機。FUSE-T 避開了這件事:專案頁自稱「Kext-less design with no kernel extension required」,改用一個本機伺服器掛載,後端可選 NFS、SMB 與原生 FSKit。
兩者都有邊角狀況,rclone 也列了出來。用 FUSE-T 時,依專案 wiki 的說法「File access and modification times cannot be set separately as it seems to be an issue with the NFS client which always modifies both」——也就是 Finder 瀏覽一下掛載點就可能改掉修改時間,進而讓 rclone 重新上傳整個檔案。另外在 --read-only 下寫入會「fail silently as opposed to with a clear warning as in macFUSE」。
如果你是用 MacPorts 而非 dmg 安裝 macFUSE,rclone 文件給了讓它找到程式庫的額外步驟:
sh
sudo mkdir /usr/local/lib
cd /usr/local/lib
sudo ln -s /opt/local/lib/libfuse.2.dylib掛上了但行為不對時
驅動程式到位之後,剩下的抱怨基本都是 VFS 快取。rclone 記載了四種模式,差別並不細微。--vfs-cache-mode off 會「read directly from the remote and write directly to the remote without caching anything on disk」;minimal「very similar to 'off' except that files opened for read AND write will be buffered to disk」;writes 下「files opened for read only are still read directly from the remote, write only and read/write files are buffered to disk first」;full 則是「all reads and writes are buffered to and from disk」。
會以讀寫方式開檔、往回 seek、原地改名的應用程式——也就是大部分桌面軟體——至少需要 writes。剩下的問題用 full 能解決,代價是磁碟空間。
把驅動程式整個拿掉的設計
這一頁上的每個錯誤都來自同一個架構選擇:把檔案系統驅動程式放進核心。要拿到一個磁碟機其實還有另一條路,而且在這三個系統上都比 FUSE 更久——WebDAV,三家都能不安裝任何東西就掛載。
AnyStorage(v0.2.24;macOS 11+、Windows 10+、Ubuntu 20.04+)走的就是這條路。它在 http://127.0.0.1:3211 上執行內建 WebDAV 伺服器,應用程式裡開啟的每個連線——支援 path-style 與自訂區域的 S3 相容端點、Cloudflare R2、MinIO、Backblaze B2、金鑰驗證的 SFTP、WebDAV——都會成為該根目錄下的一個資料夾。沒有 FUSE、沒有 WinFsp、沒有 macFUSE,沒有要核准的核心擴充功能,也不需要 $PATH 裡有 fusermount3。免費版可用兩個連線。
老實說也有代價:系統內建的 WebDAV 用戶端各有上限,Windows 重新導向器就有記載的 50,000,000 位元組預設檔案大小限制(見50 MB 限制)。但那是一個登錄值,而不是一次驅動程式安裝——這正是這場比較的重點。
WinFsp 和 rclone 的 cmount 都要裝嗎?
不用。裝好 WinFsp,rclone 會透過 cgofuse 自動使用它。Windows 端除了挑一個尚不存在的掛載點,沒有別的要設定。
rclone 用 FUSE-T 還是 macFUSE 比較好?
macFUSE 是帶核心擴充功能的傳統驅動程式,FUSE-T 免 kext、透過本機 NFSv4 伺服器掛載。如果你不能或不願核准核心擴充功能,選 FUSE-T;如果你需要精確的修改時間語意與明確的唯讀錯誤,選 macFUSE。
為什麼只有在 Docker 裡 rclone mount 會失敗?
容器通常缺 /dev/fuse 與必要的 capability。你需要把裝置傳遞進去、給 SYS_ADMIN,並在映像檔裡裝 fuse3——這也正是許多人乾脆改成從容器對外提供 WebDAV 的原因。
如果完全裝不了驅動程式,用什麼取代掛載?
rclone serve webdav 或任何本機 WebDAV 伺服器,然後用系統用戶端掛載它。這和 AnyStorage 的取捨相同,只是零件更多。
下一步
- mount 指令的桌面替代:rclone mount 替代方案
- 所有後端匯入一個磁碟機:把雲端儲存掛載為本機磁碟
- WebDAV 這條路在 Windows 上失敗時:WebDAV 錯誤 0x80070043