【超详细!!!】VPS小鸡挂载OneDrive教程,老是小改动,年年都不一样

记得收藏哟!

rclone这个软件我已经不想吐槽了,除了每一年的变化,外,无其它的“坑”,如果你翻阅以前的挂载方法,估计已经行不通了,应该软件作者已经在挂载上面做了“小小”的改变,按旧方法完全行不通。

第一篇,Win本地中获取“token” (获取客户端授权码)

将rclone客户端下载到电脑本地,在解压,获取解压之后rclone的软件包路径

软件包下载地址:https://rclone.org/downloads/

记得收藏哟!

Win64下载地址:https://downloads.rclone.org/v1.49.1/rclone-v1.49.1-windows-amd64.zip
Win32下载地址:https://downloads.rclone.org/v1.49.1/rclone-v1.49.1-windows-386.zip

复制路径,并打开CMD(Win+R,输入CMD),输入: CD rclone的软件包路径

然后,在CMD中输入命令rclone authorize "onedrive"

记得收藏哟!

这时会自动打开浏览器,在浏览器中输入您的微软账户和密码,点击并允许授权Rclone。然后,浏览器网页自动关闭或者出现Success!

这时,在点击CMD(命令提示符),出现一大段密钥,先放着不管,一会在复制使用。

第二篇,配置Linux

在配置之前,下软件,这个软件很人性,一键安装包脚本,分分钟把软件装入你VPS小鸡,完全不用担心怎么装。

官方安装脚本:curl https://rclone.org/install.sh | sudo bash

复制粘贴到SHH里面点一下回车就自动安装了。

安装完之后配置:输入命令:rclone config

不要觉得代码多,我备注的地方才是你要输入操作的地方!!!!

bash-4.2# curl https://rclone.org/install.sh | sudo bash          ————————下载并安装Rclone
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4437  100  4437    0     0   2901      0  0:00:01  0:00:01 --:--:--  2901
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15  100    15    0     0     10      0  0:00:01  0:00:01 --:--:--    10

The latest version of rclone rclone v1.49.1 is already installed.

bash-4.2# rclone config                                          ——————————初始化配置文件
2019/09/09 06:31:06 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n                                                       ——————————————点击“n”新建一个挂载器
name> OneFine
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
   \ "fichier"
 2 / Alias for an existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Google Photos
   \ "google photos"
14 / Hubic
   \ "hubic"
15 / JottaCloud
   \ "jottacloud"
16 / Koofr
   \ "koofr"
17 / Local Disk
   \ "local"
18 / Mega
   \ "mega"
19 / Microsoft Azure Blob Storage
   \ "azureblob"
20 / Microsoft OneDrive                              ————————————选择20 “ Microsoft OneDrive”
   \ "onedrive"
21 / OpenDrive
   \ "opendrive"
22 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
23 / Pcloud
   \ "pcloud"
24 / Put.io
   \ "putio"
25 / QingCloud Object Storage
   \ "qingstor"
26 / SSH/SFTP Connection
   \ "sftp"
27 / Union merges the contents of several remotes
   \ "union"
28 / Webdav
   \ "webdav"
29 / Yandex Disk
   \ "yandex"
30 / http Connection
   \ "http"
31 / premiumize.me
   \ "premiumizeme"
Storage> 20                                   ————————————选择20 “ Microsoft OneDrive”     
** See help for onedrive backend at: https://rclone.org/onedrive/ **

Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>                                   ——————————————留空,直接回车就好!
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>                             ——————————————留空,直接回车就好! 
Edit advanced config? (y/n)
y) Yes
n) No
y/n> y                                   ——————————————留空,直接回车就好!
Chunk size to upload files with - must be multiple of 320k.

Above this size files will be chunked - must be multiple of 320k. Note
that the chunks will be buffered into memory.
Enter a size with suffix k,M,G,T. Press Enter for the default ("10M").
chunk_size>                                   ——————————————留空,直接回车就好! 
The ID of the drive to use
Enter a string value. Press Enter for the default ("").
drive_id>                                    ——————————————留空,直接回车就好!
The type of the drive ( personal | business | documentLibrary )
Enter a string value. Press Enter for the default ("").
drive_type>                                    ——————————————留空,直接回车就好!
Set to make OneNote files show up in directory listings.

By default rclone will hide OneNote files in directory listings because
operations like "Open" and "Update" won't work on them.  But this
behaviour may also prevent you from deleting them.  If you want to
delete OneNote files or otherwise want them to show up in directory
listing, set this option.
Enter a boolean value (true or false). Press Enter for the default ("false").
expose_onenote_files>                                   ——————————————留空,直接回车就好! 
Remote config
Use auto config?                
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n                                                  ————————————点击“n”,千万不要单击“y”,不然又要重新新建了。
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine (same rclone version recommended) :
        rclone authorize "onedrive"
Then paste the result below:
result>               ——————————————在这里你在电脑内获取的 result,记住是一整段 
{"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6ImRPd0ozWWhtQWozRlNfVkl4aEtIS3dSSS1VdFN4cVBsdUVsSTNqd0pCR00iLCJhbGciOiJSUzI1NiIsIng1dCI6ImllX3FXQ1hoWHh0MXpJRXN1NGM3YWNRVkduNCIsImtpZCI6ImllX3FXQ1hoWHh0MXpJRXN1NGM3YWNRVkduNCJ9.eyJhdWQiOiIwMDAjoiMSIsImFpbyI6IkFTUUEyLzhNQUFBQXllYURuVkR1MlA4eXZtMkNLRkVCWFBIMWV3SExsdHFBMUFNeHFNTU5UbW89IiwiYW1yIjpbInB3ZCJdLCJhcHBfZGlzcGxheW5hbWUiOiJyY2xvbmUiLCJhcHBpZCI6ImIxNTY2NWQ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Bk8voj7wVBeXgkTwZGuFWs5zPI9HF77OjQVGrXLaC1ST1t24OTFo5X6vgA-nlOWf7ZukrK9Eu7egT_ILR_m3i6arow7oJ2_Wjj9nbVAQlAwBsFKoQ8OZx7yqFd_Wrd0j7ZoTlaps3-VVQ7UoDNlLeQIm32PJMk57YksndOs_On7R8t8Do1LBnj1qaF8Q4jNybw32HODuFBKvTlahFu_Yj-5WJibBZ_L2HARBLEibR6HGDdpQ0C8VFsw77kmfyCUgAA","expiry":"2019-09-08T23:28:06.2230418+08:00"}
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1                       ————————————————这里点击“1”,选择Business也就是“业务”
2019/09/09 06:31:57 NOTICE: Time may be set wrong - time from "login.microsoftonline.com" is 7h59m59.878964267s different from this computer
2019/09/09 06:31:59 NOTICE: Time may be set wrong - time from "graph.microsoft.com" is 7h59m59.375250187s different from this computer
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!4Af4WMptvUuoI2lKWmZ8DjTP53Sxc8NErBbI7DaiShy7YVnzONqjSpaHTZFLYIPH
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://dutaotbsteduau-my.sharepoint.com/personal/luck1990_edu365_site/Documents
Is that okay?
y) Yes
n) No
y/n> y                           选择Y,并回车
--------------------
[OneFine]
type = onedrive
token = {"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IjItRXAzbFh0azVla0x1Y2xCeGxIWkRKYURRczJRSzFCbFM0Z29aSVVTT0kiLCJhbGciOiJSUzI1NiIsIng1dCI6ImllX3FXQ1hoWHh0MXpJRXN1NGM3YWNRVkduNCIsImtpZCI6ImllX3FXQ1hoWHh0MXpJRXN1NGM3YWNRVkduNCJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC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n3qu-HVmVaXhbb3BI0u7dxSqIlQVW9uPGIUNqQIy7a7-zCbbO5N-xdW4PtvyOj5DTbet2x9OM1SnbOwQOq1yMv-G0Q","token_type":"Bearer","refresh_token":"OAQABAAAAAAAP0wLlqdLVToOpA4kwzSnxYpNwvhJORhKZrWt9mfsfy1DZ9yoRORMpp4YhXzzRm6CB9l1Q5lHXB4-oy1RKceTIhH8xh-QvE-eXcwsmahjeeKY3JksOxTsauxDtHTasOz5rvkyaFXfWChMjVT_73RGKAkTIOE4JX4-boz33A7bmFaZSa9_YwG8pnIEjOKwW-z3fCRvbTusF0K9eMM8Y8sYEVkfPIxxfFp93tMzYsmsotB3USCKPpoF9w8Oiusq-rrrnvORW2olPv5Z2wSbdeCq4_gQxxxaQk3yIgB1P9slb8JUd32bkqLuXMTbikQNmR6_MOOC423NpQAIZYZpu9YdNwvfl5S3fTY_bIErCAQj7G4NBtkcj4IQYN_6iRpb3i-6ZnTgUYexqW6OxLVClXrXK69cZ6gsBjQXyqlh3LyW4jDDZyznyQQ-XNDTKT7j_HRsH4ElR2HRiKySXxy91PWxe0Jv9o2J4cF9v5HZyy0lM0YkjfSTan8SOwkNCyRijElkJKHbq4pnS76dZ1wUnrbFrcC2IohIzK6qEp6xYe19B0St7mi8vJV1EBcYYrh40EDPt3IFNaOVSmcscMRVEmMbuwGCS6v-Y7WZ0y35IdJwtBYIN97fdYbUR9nxMaWEPxbJu95YY9S9sn-ubeILoXXIxtgVFYIYCmXs_z1wErNHfPenE8yolWTlnahbuGTcmpHUf66Bn_dP5Er7fLgGyp8PibrwIikINgevci143xBvAlKBGPhZjuJHTFyHwkSvXReD6HgqgNcYbwNGZ6ZsHeSi0eU2Uhx4eiytmGCbCg76P5KV6h_ZfJEkNwsonMKTzAB4gAA","expiry":"2019-09-09T07:31:56.879124534+08:00"}
drive_id = b!4Af4WMptvUuoI2lKWmZ8DjTP53Sxc8NErBbI7DaiShy7YVnzONqjSpaHTZFLYIPH
drive_type = business
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y                              ——————————点击“y”,就OK了。   
Current remotes:

Name                 Type
====                 ====
OneFine              onedrive

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> q             ——————————————————点击q退出

配置完这些,然后挂载磁盘,我一般挂载在/Data下的

rclone mount OneFine:/ /data --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

df -h 查看配置状态。

————————————————————————————————————————————————————

#新建本地文件夹,路径自己定,即下面的LocalFolder
mkdir /root/OneDrive
#挂载为磁盘
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

DriveName为初始化配置填的name,Folder为OneDrive里的文件夹,LocalFolder为VPS上的本地文件夹。

如果挂载过程中出现NOTICE: One drive root 'test': poll-interval is not supported by this remote错误,可以无视该错误。(一样情况

如果出现Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount": executable file not found in $PATH错误
请安装Centos解决办法:

yum install fuse

Debian/Ubuntu解决办法:

apt-get install fuse
apt-get install fuse

2、卸载磁盘

fusermount -qzu LocalFolder

自启动
1、下载并编辑脚本
使用命令:

wget -N --no-check-certificate https://raw.githubusercontent.com/x91270/Centos/master/rcloned 

vi rcloned

修改一下内容:

NAME=""  #rclone name名,及配置时输入的Name
REMOTE=''  #远程文件夹,OneDrive网盘里的挂载的一个文件夹
LOCAL=''  #挂载地址,VPS本地挂载目录

设置自启

mv rcloned /etc/init.d/rcloned
chmod +x /etc/init.d/rcloned
chkconfig rcloned on
bash /etc/init.d/rcloned start

检测信息显示rclone启动成功即可。

RCLOAD的启动停止命令

bash /etc/init.d/rcloned start
bash /etc/init.d/rcloned stop

注意一点,现在的这个版本是复制一整段!!!!!

记得收藏哟!

一整段全部复制了!!!!!

本文章摘抄至萌鼠博客:https://www.moerats.com/archives/491/
和ImYrS Network教程https://imy.rs/228.html

Last modification:October 13th, 2019 at 05:23 pm
如果觉得我的文章对你有用,请随意赞赏

2 comments

  1. ysuzy

    我的vps用rclone挂载onedrive成功后,用命令方式复制服务器上2.6G视频文件到云盘上,每次上传不久进程就会自动被kill,请问什么问题?

    1. Dream.
      @ysuzy

      试试看,估计是这样的,缓冲内存太小了,造成的失误,重新建一个OneDrive连接,然后将文件块改成320M
      https://i.loli.net/2019/11/16/5Wq3JpLhRgjelHY.png

Leave a Comment