2019.3.7更新

更正一下,MultCloud有钱钱的可以考虑一下,毕竟傻瓜操作,重要的是:支持百度云(很多珍贵的资源都存了在这。。)

image
image

百度云他走的是api,只能读取这几个文件夹,试用前要把数据手动移动到我的应用数据里。

这里是分界线




很久之前从别人的edu账号申请了office365账户,理论上永久的。没想到是黑号,最近那个管理员被ban了,我们这些子账号不知道安不安全,有点慌。onedrive里面还存了很多宝贵的文件!一个个下载回来得多麻烦!

正好从群友那搞到个相对安全的office365账户(他自己弄的),就想着能不能直接从旧onedrive保存到这个新onedrive。可是巨硬的盘并没有自动的方式可以在不同OneDrive之间迁移数据,也不支持分享然后保存的。Microsoft Flow也不支持onedrive business互转。

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

  1. MultCloud (富婆可以建议一下下)

MultCloud是个在线服务,通过网页就能一键将各个网盘的数据互传,傻瓜操作。但这货免费版只有50g流量一个月,根本不够用,而且速度很慢。
这货有个优点,支持国内的百度云,rclone却不支持。

  1. Air Explorer(不建议)

Air Explorer是个windows/mac平台的软件,也能一键将各个网盘的数据互传。但它的速度取决于你家的网络,像几百g的东西得等多久,不现实!

  1. 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

因为我的小鸡是OVZ,这商家不支持FUSE挂载,就不搞这个了(

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

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

退出rclone,然后输入

screen rclone copy onedrive1: onedrive2:

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

最后

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

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

image
image

建议手动指定文件夹复制到文件夹rclone copy onedrive1:/galgame onedrive2:/galgame这样比较安全(确信

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

参考: 常阳时光 使用 rclone 将 Google Drive 文件同步至 OneDrive
Rclone中文站