最近经常在各种渠道看到有微软即将对E5 Developers订阅引入更多限制,并且会逐渐将审核设置得更严格,而同时不久之前下定决心要减少对家里的不稳定的NAS的依赖的我把目前几乎是所有重要数据放在了E5 Developers中的OneDrive上,我自然是越看越慌。于是决定趁在出事之前就把重要数据迁移到OneDrive个人版上。

这里把自己用rClone迁移数据的经历写一下,也希望能够帮助到最近受E5政策改变影响的各位。

Microsoft 365 家庭版拼车

NS的坛友向我推荐了Microsoft 365 家庭版拼车这种方式,量大便宜也算稳定,并且1T的OneDrive空间也足够我使用,于是就选择了一家淘宝上的号称老商家的一家店铺上了车。

迁移用VPS

先前我在netcup上买了一台免税后月付6.13EUR的ARM VPS,评测见Netcup VPS 1000 ARM G11 NUE iv 德国机房 免税后6.13O/月 评测
这台机的主要卖点就是高性能,口子和硬盘都很大,性价比比较高,2.5G无限流量的带宽很适合数据处理,256G的硬盘对存放迁移我的数据的临时文件这点量是绰绰有余的。

开始吧!

rClone配置

迁移用的是rClone,并且因为我自己习惯用Debian,所以可以直接使用以下脚本安装:

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

安装完毕后,在终端输入:

rclone config

输出如下:

root@v2202402216899256170:~# rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

因为要创建一个新的存储方式,所以输入n并回车。

Enter name for new remote.
name> OneDrivePersonal

这里会要求你输入存储方式的名字,这里我以OneDrivePersonal为例。
回车,会要求你选择存储方式提供商。


点击展开存储方式提供商列表

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
 \ (fichier)
 2 / Akamai NetStorage
 \ (netstorage)
 3 / Alias for an existing remote
 \ (alias)
 4 / Amazon Drive
 \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
 \ (s3)
 6 / Backblaze B2
 \ (b2)
 7 / Better checksums for other remotes
 \ (hasher)
 8 / Box
 \ (box)
 9 / Cache a remote
 \ (cache)
10 / Citrix Sharefile
 \ (sharefile)
11 / Combine several remotes into one
 \ (combine)
12 / Compress a remote
 \ (compress)
13 / Dropbox
 \ (dropbox)
14 / Encrypt/Decrypt a remote
 \ (crypt)
15 / Enterprise File Fabric
 \ (filefabric)
16 / FTP
 \ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
 \ (google cloud storage)
18 / Google Drive
 \ (drive)
19 / Google Photos
 \ (google photos)
20 / HTTP
 \ (http)
21 / Hadoop distributed file system
 \ (hdfs)
22 / HiDrive
 \ (hidrive)
23 / In memory object storage system.
 \ (memory)
24 / Internet Archive
 \ (internetarchive)
25 / Jottacloud
 \ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
 \ (koofr)
27 / Local Disk
 \ (local)
28 / Mail.ru Cloud
 \ (mailru)
29 / Microsoft Azure Blob Storage
 \ (azureblob)
30 / Microsoft OneDrive
 \ (onedrive)
31 / OpenDrive
 \ (opendrive)
32 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
 \ (swift)
33 / Pcloud
 \ (pcloud)
34 / Put.io
 \ (putio)
35 / SMB / CIFS
 \ (smb)
36 / SSH/SFTP
 \ (sftp)
37 / Sia Decentralized Cloud
 \ (sia)
38 / Sugarsync
 \ (sugarsync)
39 / Transparently chunk/split large files
 \ (chunker)
40 / Union merges the contents of several upstream fs
 \ (union)
41 / Uptobox
 \ (uptobox)
42 / WebDAV
 \ (webdav)
43 / Yandex Disk
 \ (yandex)
44 / Zoho
 \ (zoho)
45 / premiumize.me
 \ (premiumizeme)
46 / seafile
 \ (seafile)
Storage> 30


在现在版本的rClone(v1.65.2),OneDrive的个人版本与商业(E5)版本是通用的,因此直接输入30并回车就可以。
之后对OneDrive的设置几乎全部可以使用默认。

Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id> 

留空,回车。

Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> 

留空,回车。
以上两个配置项是当我们自己使用自己的API时才会用到,我们一般可以直接回车来使用rClone提供的API。
但是如果你真的想要使用自己的API的话,配置可以参见Microsoft OneDrive - rClone
随后是选择OneDrive的区域,因为目前OneDrive的个人版和商业版(E5)都是由Microsoft Cloud Global运营,所以直接在这个选项里面输入1回车就可以了。

Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
 1 / Microsoft Cloud Global
   \ (global)
 2 / Microsoft Cloud for US Government
   \ (us)
 3 / Microsoft Cloud Germany
   \ (de)
 4 / Azure and Office 365 operated by Vnet Group in China
   \ (cn)
region> 1

随后advanced config这一项直接选择n回车就可以。

Edit advanced config?
y) Yes
n) No (default)
y/n> n

auto config选择no,根据它的描述,我们正在一台远程机器上操作,所以直接选择n回车。

Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> n

随后要求输入Option config_token时,我们需要在本地电脑上面在Rclone downloads - rClone上下载对应你的系统架构的版本,这里以我使用的Windows为例。
在存放rClone的目录打开Poweishell,输入.\rclone.exe authorize "onedrive",并且在弹出的浏览器窗口完成授权,就可以看到上图中出现的类似的token.

把整个大括号部分的token复制出来,粘贴输入,回车。

Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
        rclone authorize "onedrive"
Then paste the result.
Enter a value.
config_token> {"access_token":"1145141919180","expiry":"2024-02-12T20:04:49.5183677+08:00"}

接下来rClone会让你选择OneDrive的存储类型,因为我们需要添加的是OneDrive个人版和企业版,根据描述我们只需要输入1回车即可。

Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
 1 / OneDrive Personal or Business
   \ (onedrive)
 2 / Root Sharepoint site
   \ (sharepoint)
   / Sharepoint site name or URL
 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
   \ (url)
 4 / Search for a Sharepoint site
   \ (search)
 5 / Type in driveID (advanced)
   \ (driveid)
 6 / Type in SiteID (advanced)
   \ (siteid)
   / Sharepoint server-relative path (advanced)
 7 | E.g. /teams/hr
   \ (path)
config_type> 1

之后config_driveid选择的界面一般来说只需要直接选择默认的那一个回车就可以。

Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default (1145141919810).
 1 / OneDrive (personal)
   \ (1145141919810)
config_driveid> 1  

之后询问Drive OK?时候一般只需要输入y回车。

Drive OK?

Found drive "root" of type "personal"
URL: https://onedrive.live.com?cid=1145141919810&id=1145141919810

y) Yes (default)
n) No
y/n> y

随后就是总结页面,确认自己输入的信息无误之后,输入y确认即可。

Configuration complete.
Options:
- type: onedrive
- token: {"access_token":"1145141919810","expiry":"2024-02-12T20:04:49.5183677+08:00"}
- drive_id: 1145141919810
- drive_type: personal
Keep this "OneDrivePersonal" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

这样一个存储方式就添加完了,再次输入rclone config,就可以看到添加完成了。

Current remotes:

Name                 Type
====                 ====
OneDrivePersonal     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> 

随后再添加E5的OneDrive,添加方式与上述完全相同。

开始迁移

最好先安装一个screen,来防止你断开SSH连接时传输中断。
进入screen窗口之后,假设我把个人版OneDrive命名为OneDrivePersonal,把E5上的OneDrive命名为OneDriveBusiness,那么要全部copy的话,输入:

rclone copy OneDriveBusiness: OneDrivePersonal: -v

这样,迁移进程就开始了。
我的数据大约是400G,在大多数都是小文件的情况下迁移用了约24小时,如果都是大文件的话所需时间会少很多。
迁移完毕之后,要注意检查文件完整性,避免有文件遗漏或损坏的情况出现。