Centos 使用rclone将onedrive文件相互复制对拷

经验技巧 admin 250℃ 0评论

从网上搜了下,有三好使的办法:

  1. MultCloud (富婆可以建议一下下)
    MultCloud是个在线服务,通过网页就能一键将各个网盘的数据互传,傻瓜操作。但这货免费版只有50g流量一个月,根本不够用,而且速度很慢。

这货有个优点,支持国内的百度云,rclone 却不支持。

  1. Air Explorer(不建议)
    Air Explorer是个windows/mac平台的软件,也能一键将各个网盘的数据互传。但它的速度取决于你家的网络,像几百g的东西得等多久,不现实!
  2. Rclone(推荐)
    Rclone是一款命令行小程序,支持市面上各种各样的网盘间进行同步、上传、下载数据。它优点是能挂在VPS上,24小时同步备份。省时省电!

下面简单记一下本菜鸡用 Rclone 的备份过程:

Reclone安装

翻出来很久之前黑五买的小鸡 (装了 centos7),输入官网的一键代码安装 Rclone,安装过程很快的说。

curl https://rclone.org/install.sh | sudo bash

获取onedrive授权码

https://rclone.org/downloads/ 下载 windows AMD64 – 64 Bit 平台的 Rclone
解压,然后 cmd 到那个文件夹,输入

rclone authorize "onedrive"

这时会弹出浏览器,登录你的 onedrive,显示这个即可完成授权

image
image

然后回来刚刚的 cmd,会看到 {} 里面一大段代码,这个就是授权码了

image
image
{"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","expiry":"2019-03-03T21:58:45.6416642+08:00"}

先放着窗口,等会要用到。

连接onedrive网盘

Ssh 连接小鸡,输入

./rclone config
#~:rclone config
No remotes found - make a new one
n) New remote 连接新远程网盘
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive1 随便起个名字
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 / Alias for a existing remote
   \ "alias"
 2 / Amazon Drive
   \ "amazon cloud drive"
 3 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
   \ "s3"
 4 / Backblaze B2
   \ "b2"
 5 / Box
   \ "box"
 6 / Cache a remote
   \ "cache"
 7 / Dropbox
   \ "dropbox"
 8 / Encrypt/Decrypt a remote
   \ "crypt"
 9 / FTP Connection
   \ "ftp"
10 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
11 / Google Drive
   \ "drive"
12 / Hubic
   \ "hubic"
13 / JottaCloud
   \ "jottacloud"
14 / Local Disk
   \ "local"
15 / Mega
   \ "mega"
16 / Microsoft Azure Blob Storage
   \ "azureblob"
17 / Microsoft OneDrive
   \ "onedrive"
18 / OpenDrive
   \ "opendrive"
19 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
20 / Pcloud
   \ "pcloud"
21 / QingCloud Object Storage
   \ "qingstor"
22 / SSH/SFTP Connection
   \ "sftp"
23 / Webdav
   \ "webdav"
24 / Yandex Disk
   \ "yandex"
25 / http Connection
   \ "http"
Storage> 18 这里连接的onedrive,所以选18
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> n 填n
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> 直接回车就好
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
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
    rclone authorize "onedrive"
Then paste the result below:
result> 这里填入刚刚电脑浏览器获取的OneDrive授权码。
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
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Chose drive to use:> 这里检测到你账户拥有的OneDrive,填0
Found drive 'root' of type 'business', URL: https://lookertbsteduau-my.sharepoint.com/personal/xxxxxxxxx/Documents
Is that okay?
y) Yes
n) No
y/n> 填y确认
[one]
type = onedrive
token = {"access_token":"xxxxxxxxxxx"}
drive_id = xxxxxxxxxxxx
drive_type = business

y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> 再填y确认就完事了

然后我们再输入

./rclone config

就能看到刚刚添加的网盘了。

image
image

然后重复上述步骤,再连接一个 onedrive。

两个网盘都添加完成后,就可以正式开始对拷了

退出 rclone,然后输入

rclone copy onedrive1:/galgame onedrive2:/galgame

就能断开 ssh 让它后台备份了。(会出现假死状态,其实是在运行的)

最后

rclone 这东西不怎么占 cpu 和内存,可以放心使用。而且对小鸡的空间不会有很大影响。再加上 VPS 本身拥有很强大的上传和下载能力,备份效果非常棒!很快就能完成!

但!
建议不要直接用 rclone copy onedrive1: onedrive2:! 我的 30g 小鸡不知道是不是遇到 bug,它直接把我空间吃满,小鸡直接炸掉只能重装了。。。

image
image

这东西还有个缺点,就是耗费的流量是双倍的,因为要用到上传和下载呢!但 vps 的流量这么多,每个月根本用不完,也不在乎这点流量了。还有不支持百度云。

转载请注明:乐酷坊 » Centos 使用rclone将onedrive文件相互复制对拷

喜欢 (0)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址