rclone使用二:將onedrive掛載到Linux系統的vps

優點:提升空間大小,onedrive也有比較便宜的(非個人版5T or 1T)
缺點:較爲依賴網速,性能上肯定沒物理的加硬盤好
當前環境:vps:Debain系統(Ubuntu命令相同),本地:Windows,vps上已安裝rclone
沒安裝rclone的請看 rclone使用一:安裝
1、由於在無桌面版Linux系統下,可能無法獲取授權等內容,可以通過本地下載(windows環境)rclone獲取access_token解決
下載windows版(下載地址:https://rclone.org/downloads/),解壓到D盤(其他也可以,只是要修改路徑)。
當前目錄爲

D:\rclone

以管理員模式打開cmd(win+R可能會出現權限問題),輸入

cd /d d:\rclone
rclone authorize "onedrive"

2、輸入上述命令後,會彈出瀏覽器訪問,到登錄賬號後,綁定,cmd窗口會出現access_token內容,如:

{"access_token":xxxxxxxxxxx}

保存一下你的access_token,後面會用到
3、在Linux上輸入以下命令配置

rclone config

4、第一次會出現,選擇n

n) New remote s) Set configuration password q) Quit config

5、name隨便填,但是要記住,演示使用name爲od
6、選擇你想綁定的網盤序號(不同版本序號可能不一樣),找到顯示以下內容的序號,輸入

/ Microsoft OneDrive \ "onedrive"

7、此時會提示輸入Client Id 和Client Secret,全都留空(輸入回車即可)
8、可能還會出現版本選擇或者Use auto config等選項,根據實際情況選擇,Use auto config一般選擇No
9、出現result的時候,粘貼之前保存的{"access_token":xxxxxxxxxxx},回車,無錯誤的情況下,會出現

y) Yes this is OK e) Edit this remote d) Delete this remote

10、選擇y,最後還會出現以下內容,選擇q退出(如需再添加請輸入rclone config)

e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config

11、新建文件夾(這個文件夾將會成爲本地顯示文件夾),mkdir 路徑,這裏演示爲root下新建onedrive文件

mkdir /root/onedrive

12、掛載磁盤,演示name爲od,本地文件爲/root/onedrive,網盤目錄爲根目錄/的情況,下面命令可能會出現你再輸入別的命令,不能運行的問題(解決可參考後臺screen運行,或者開機自啓部分)

rclone mount od:/ /root/onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

如出現fuse錯誤,大概率是因爲沒安裝fuse,輸入下面命令解決,再運行上述命令(以Debain爲例)

apt-get install fuse

如是centos系統使用

yum install fuse

13、查看是否掛載成功,掛載成功後會多顯示你的掛載名和路徑,大小

df -h

14、如果不需要了可以卸載掉

fusermount -qzu 本地文件路徑
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章