迁移软件
用到的主角Rclone,这个软件挺不错的。
迁移用VPS
买了一台 https://www.interserver.net/r/1053412
开始迁移
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. 30 / Microsoft OneDrive \ (onedrive)
在现在版本的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
最好先安装一个screen,来防止你断开SSH连接时传输中断。
yum install screen -y #centos系 apt install screen -y #debian系
使用screen
#建立一个会话窗口 screen -S chuangkou #这是建立了一个名为:chuangkou的screen会话窗口 #退出该会话窗口 ctrl+a,然后按d #列表目前小鸡上所有的已开会话窗口 screen -ls #重新连接到名为chuangkou的会话窗口 screen -R chuangkou #就能看到之前运行情况了
进入screen窗口之后,假设我把个人版OneDrive命名为OneDrivePersonal,把E5上的OneDrive命名为OneDriveBusiness,那么要全部copy的话,输入:
rclone copy OneDriveBusiness: OneDrivePersonal: -v
这样,迁移进程就开始了。
我的数据大约是400G,在大多数都是小文件的情况下迁移用了约24小时,如果都是大文件的话所需时间会少很多。
迁移完毕之后,要注意检查文件完整性,避免有文件遗漏或损坏的情况出现。
评论前必须登录!
注册