作者iamdco (DC)
看板Free_box
标题[心得] Google Drive 迁移教学
时间Tue Mar 9 16:58:51 2021
因为教育号的无限空间即将取消了,目前要转移到有无限空间的地方就只有 Google 或 M
icrosoft 的付费方案。
如果是 Google Drive 迁移 Google Drive 的话,建议开免费 GCP 来转移,速度快流量
免费。
如果是 Google Drive 迁移 Microsoft 的话,开 GCP 有 300 美金可以使用,但是传输
到 Microsoft 要算流量费,注意不要超过 300 美金。
第一篇 使用 rclone
事先准备
一。针对申请 GCP 的部份,要有Google帐号与信用卡,超过流量才会扣款。当然也可以
使用自己的电脑。
二。需略懂 Linux,会尽量写的新手也能看的懂。
三。教学的 rclone 版本为 v1.54.1
第一步 申请 Google Cloud Platform (gcp)
https://cloud.google.com/gcp/getting-started/?hl=zh-tw
免费试用
运用 $300 美元的免费抵免额和 20 项以上的一律免费产品,开始在 Google Cloud 中建
构内容。
点 [免费开始使用] 来申请帐号
1.登入
继续使用 Google Cloud Platform,没有帐号的话请点 [建立帐户]
这里我们直接登入现有的 google 帐号密码登入
2.免费试用 Google Cloud Platform
步骤 2 之 1
服务条款 需要都勾选才能按下 [继续]
步骤 2 之 2
帐户类型 -> 个人
税务资讯 -> 未登记税籍的个人
填好必要的资料後按下 [开始免费试用]
3.XXX,欢迎使用!
感谢您提出申请。我们会在免费试用期间提供价值 $300 美元的抵免额,让您在未来 90
天内使用。请放心,除非您启用了自动计费功能,否则即便抵免额用尽也不会产生费用。
按下 [我知道了]
申请的时候我收到银行简讯扣款40元,但应该只是 Google 验证用不会请款。
计画启动方式
。如要完成免费试用期的申请程序,请务必提供信用卡资讯或其他付款方式来设定帐单帐
户及验证身分。请放心,设定帐单帐户并不会启动收费机制。除非您升级为付费帐户并明
确启用计费功能,否则我们不会收费。您可以在试用期间随时升级为付费帐户。如在 90
天试用期间升级帐户,仍可继续使用剩余的抵免额。
计画涵盖范围
。免费试用期的抵免额适用於所有 Google Cloud 资源,包括 Google 地图平台用量,唯
下列作业除外:
。同时执行超过 8 个核心 (或虚拟 CPU)。
。将 GPU 新增至 VM 执行个体。
。要求提高配额。如要查看 Compute Engine 配额总览,请参阅资源配额一文。
。依据 Windows Server 映像档建立 VM 执行个体。
。您必须升级为付费帐户,才能执行上述各项操作。
4.开启免费伺服器
https://cloud.google.com/free?hl=zh-tw
每个月可使用 1 个 f1-micro 执行个体,可弹性扩充的高效能虚拟机器。
每个月可以在下列其中一个美国区域中使用 1 个非先占 f1-micro VM 执行个体:
奥勒冈州:us-west1
爱荷华州:us-central1
南卡罗来纳州:us-east1
每月 30 GB HDD
左上角 导览选单 -> Compute Engine -> VM 执行个体
第一次开启的时候要先等他一下
正在启用 Compute Engine,这项作业可能需要几分钟的时间才能完成。「Compute Engin
e」说明文件
可能不会自动更新,建议可以点 [执行个体范本] 再点回 [VM 执行个体]
当可以使用的时候 VM 执行个体 的 [建立] 就可以点选了
。新增 VM 执行个体 ->
名称:自订
区域:us-central1 , us-central1-a
。机器设定 -> 机器系列 -> 一般用途
系列:N1
机器类型:f1-micro
。开机磁碟 -> [变更] -> 公开映像档 ->
作业系统:CentOS
版本:CentOS 7
开机磁碟类型:标准永久磁碟
大小(GB):30
。安全性 -> 受防护的 VM
启用 vTPM,启用完整性监控功能 我都是取消勾选
右上角可以看到 本月使用「f1-micro」执行个体的前 744 小时完全免费。
按下 [建立]
我们把外部IP记录下来,这里使用 115.234.0.1 当范例
连结 -> SSH 按一下 往下的箭头 有 在浏览器视窗中开启 等等的选项 ->
在浏览器视窗中开启会 自动带 key 进去
因为是比较简单的教学,我们使用 [在浏览器视窗中开启] 的功能。
但大多时间建议使用 [使用其他 SSH 用户端]
https://cloud.google.com/compute/docs/instances/connecting-advanced#thirdparty
tools
并在 VPC网路 -> 防火墙 -> 限定 SSH 连线的来源位置
VPC网路 -> 外部 IP 位置 -> 类型 -> 改成 静态
第二步 使用免费的 GCP CentOS 7 安装 Rclone
在第一步的时候我们已经在 GCP 的 SSH 里选择 在浏览器视窗中开启
接下来的步骤都在那个 SSH 的视窗里执行
我们先安装必要的 unzip 与 screen
输入
sudo yum install -y unzip screen
他会开始自己安装看到下面的字样
Installed:
screen.x86_64 0:4.1.0-0.26.20120314git3c2946.el7 unzip.x8
6_64 0:6.0-21.el7
Complete!
就是安装完成了
输入
date
可以看到时间为 UTC
Tue Mar 9 06:35:15 UTC 2021
我们改成台湾时间比较好懂
输入
sudo ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
date
可以看到时间为台湾的时间了
Tue Mar 9 14:35:21 CST 2021
接下来安装 rclone 输入
curl
https://rclone.org/install.sh | sudo bash
看到下面的字样
rclone v1.54.1 has successfully installed.
Now run "rclone config" for setup. Check
https://rclone.org/docs/ for more det
ails.
就是安装完成了
第三步 设定 rclone config
几个方式都会写第一个先
1.gd 个人盘 -> gd 个人盘
输入
rclone config
新增的选项是
n) New remote
所以我们输入 n
n/s/q> n
我们自订名称输入 gd01
name> gd01
会列出目前有 42 个服务可以使用,我们要输入 15 / Google Drive
Storage> 15
预设值按输入键就好
client_id>
client_secret>
再来是权限通常来源我都是选 2 唯读,目的地才选 1 最大权限
scope> 1
预设值按输入键就好
root_folder_id>
service_account_file>
进阶选项
Edit advanced config? (y/n)
y) Yes
n) No (default)
预设值按输入键就好
y/n>
远端设定请输入 n
Remote config
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
Please go to the following link: 後面的连结点一下,登入你资料来源的帐号然後在
「rclone」想要存取您的 Google 帐户 按下 [允许]
将那一串带登入的 key 复制下来, ctrl+v 到下面的 code>
Enter verification code>
接下来是问要不要设定 Team Drive?请输入 n
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
确认资讯是否正确?预设值按输入键就好
[gd01]
type = drive
scope = drive
token = {"access_token":"xxxxxx"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
可以看到 gd01 已经建立完毕,我们依上面的步骤按 n 再建立 gd02
Current remotes:
Name Type
==== ====
gd01 drive
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> n
如果 gd01 gd02 都建立完毕後,我们再按 q 离开 rclone config
Current remotes:
Name Type
==== ====
gd01 drive
gd02 drive
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
我们先输入
screen -S gd01togd02
建立多重视窗,视窗关闭或是下次要进来时输入
screen -x gd01togd02
要看有开启那些多重视窗可以输入
screen -ls
如果要一个一个资料夹单独复制可以使用 copy ,如果是整个目录都复制可以使用 sync
如果我要将 gd01 我的云端硬碟 > Music 整个复制到 gd02 我的云端硬碟里指令可以这
样输入
rclone -vv sync gd01:Music gd02:Music
下列是传输画面,碎档多的话速度就会变慢,单一大档案的话速度会比较快
2021/03/09 15:27:06 INFO :
Transferred: 1.580G / 212.132 GBytes, 1%, 27.301 MBytes/s, ETA 2h11m37s
Transferred: 20 / 4364, 0%
Elapsed time: 1m1.3s
Transferring:
* Magic/CD3/CD3.bin: 80% /738.661M, 6.792M/s, 21s
* Magic/CD1/CD1.bin: 62% /727.434M, 5.787M/s, 46s
* Magic/CD4/CD4.bin: 72% /645.177M, 6.422M/s, 27s
* Magic/CD2/CD2.bin: 13% /734.545M, 3.964M/s, 2m41s
如果你想先搬重要的资料夹而且资料夹有空格与非英文字的话,要用 "" 包起来,例如
rclone -vv copy gd01:Music/"我爱听的歌 第一集" gd02:Music/"我爱听的歌 第一集"
2.gd 共用云端硬碟td -> gd 共用云端硬碟td
刚刚的视窗已经用於 gdtogd 我们有开 screen 所以直接把视窗关闭就可以
我们回到左上角导览选单 -> Compute Engine -> VM 执行个体 -> 连结 -> 在浏览器视
窗中开启
我们输入
screen -ls
可以看到 gd01togd02 的多重视窗还存在,随时可以输入 screen -x gd01togd02 登入
There is a screen on:
10366.gd01togd02 (Attached)
1 Socket in /var/run/screen/S-dcshare.
不过这一次我们要设定 td 所以输入
screen -S gd02tdtogd01td
一样输入
rclone config
e/n/d/r/c/s/q> n
name> gd01td
Storage> 15
client_id>
client_secret>
scope> 1
root_folder_id>
service_account_file>
y/n>
y/n> n
登入 gd01 帐号
Enter verification code> ctrl+v 贴上 code
Team Drive 这里选 y
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y
他会列出你目前所有的 Team Drive ,我们这次范例输入 2
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / ttest
\ "0Axxxx"
2 / test
\ "0Axxx"
Enter a Shared Drive ID> 2
y/e/d>
就能看到 gd01td 建立完成罗~
Current remotes:
Name Type
==== ====
gd01 drive
gd01td drive
gd02 drive
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> n
我们一样输入 n 建立 gd02td 前面步骤都相同
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / abc001
\ "0Axxx"
Enter a Shared Drive ID> 1
y/e/d>
就能看到 gd02td 建立完成罗~
Current remotes:
Name Type
==== ====
gd01 drive
gd01td drive
gd02 drive
gd02td drive
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
我们这次只要复制其中一个资料夹的话可以这样下,目录名称不需要带 Team Drive 的名
称,因为我们已经设定到 Team Drive 资料夹内
rclone -vv copy gd02td:Music/"我爱听的歌 第二集" gd01td:Music/"我爱听的歌 第二
集"
就开始复制罗~这次范例是4GB 一个档案,可以看到速率就飙上去了~
Transferred: 19.215G / 69.114 GBytes, 28%, 82.048 MBytes/s, ETA 10m22s
Transferred: 4 / 18, 22%
Elapsed time: 4m0.7s
Transferring:
* part04.rar: 25% /3.905G, 20.265M/s, 2m26s
* part05.rar: 23% /3.905G, 20.369M/s, 2m30s
* part06.rar: 24% /3.905G, 21.818M/s, 2m18s
* part07.rar: 18% /3.905G, 17.719M/s, 3m3s
剩下要怎麽使用就自由发挥罗~
放了一天来看因为 SSH 允许所有人连入,只是要使用 key 才能登入。
输入
sudo lastb
可以看到有人尝试透过帐密登入但是都被挡下来了。
support ssh:notty 141.98.80.85 Wed Mar 10 08:20 - 08:20 (00:00)
guest ssh:notty 141.98.80.83 Wed Mar 10 08:20 - 08:20 (00:00)
ubnt ssh:notty 141.98.80.82 Wed Mar 10 08:20 - 08:20 (00:00)
guest ssh:notty 141.98.80.71 Wed Mar 10 08:20 - 08:20 (00:00)
test ssh:notty 141.98.80.69 Wed Mar 10 08:20 - 08:20 (00:00)
admin ssh:notty 141.98.80.82 Wed Mar 10 08:20 - 08:20 (00:00)
user ssh:notty 141.98.80.71 Wed Mar 10 08:20 - 08:20 (00:00)
admin ssh:notty 141.98.80.70 Wed Mar 10 08:20 - 08:20 (00:00)
admin ssh:notty 141.98.80.69 Wed Mar 10 08:20 - 08:20 (00:00)
uploader ssh:notty c-73-208-94-123. Wed Mar 10 06:31 - 06:31 (00:00)
pi ssh:notty 93.51.127.23 Wed Mar 10 06:29 - 06:29 (00:00)
ubnt ssh:notty 195.54.160.250 Wed Mar 10 03:25 - 03:25 (00:00)
admin ssh:notty 185.220.102.4 Wed Mar 10 00:37 - 00:37 (00:00)
admin ssh:notty 209.127.17.242 Wed Mar 10 00:37 - 00:37 (00:00)
admin ssh:notty 23.129.64.210 Wed Mar 10 00:37 - 00:37 (00:00)
admin ssh:notty 185.220.101.194 Wed Mar 10 00:37 - 00:37 (00:00)
odoo ssh:notty 202.28.194.163 Wed Mar 10 00:01 - 00:01 (00:00)
ubnt ssh:notty 31.210.22.2 Tue Mar 9 20:55 - 20:55 (00:00)
testuser ssh:notty 45.93.201.193 Tue Mar 9 18:55 - 18:55 (00:00)
zyfwp ssh:notty 195.54.160.250 Tue Mar 9 15:29 - 15:29 (00:00)
输入
last
可以看到成功登入的使用者都是我自己 与 screen
test pts/2 35.235.241.16 Wed Mar 10 10:58 still logged in
test pts/1 35.235.240.5 Wed Mar 10 07:02 - 07:57 (00:55)
test pts/1 35.235.240.2 Wed Mar 10 01:21 - 02:08 (00:46)
test pts/3 :pts/2:S.0 Tue Mar 9 15:44 - 17:29 (01:45)
test pts/0 :pts/1:S.0 Tue Mar 9 15:23 - 15:46 (00:23)
test pts/1 35.235.241.18 Tue Mar 9 14:13 - 15:46 (01:32)
test pts/0 35.235.241.19 Tue Mar 9 14:05 - 14:27 (00:22)
reboot system boot 3.10.0-1160.15.2 Tue Mar 9 14:01 - 10:58 (20:56)
用浏览器登入的 IP 落在 35.235.241.0/24 与 35.235.240.0/24
https://cloud.google.com/iap/docs/using-tcp-forwarding#console
这里写着 35.235.240.0/20 我们只开这个区段 SSH 连入就好
左上角 导览选单 -> 网路 -> VPC 网路 -> 防火墙
点一下 [default-allow-ssh] -> 编辑 -> 我们把 0.0.0.0/0 删除
增加 35.235.240.0/20 -> 储存
第二篇 使用 rclone + --drive-server-side-across-configs=true
回到 VM 执行个体 -> 连结 -> SSH -> 在浏览器视窗开启
PTT 网友 LeisCat 提供 --drive-server-side-across-configs 这个参数的使用范例
在 Server 端传输档案,不会使用到 Client 流量
首先我先将档案复制一份来测试
rclone -vv copy --drive-server-side-across-configs gd01:test gd01:test2
可以看到是 server-side copy
2021/03/10 11:32:29 INFO : xxxxx: Copied (server-side copy)
而且速度很快
Transferred: 206.508G / 1.901 TBytes, 11%, 1.739 GBytes/s, ETA 16m40s
Transferred: 157 / 7994, 2%
Elapsed time: 2m1.0s
不过复制到 1.2TB 时限流了
Transferred: 1.219T / 1.901 TBytes, 64%, 322.791 MBytes/s, ETA 36m56s
Transferred: 6007 / 7994, 75%
Elapsed time: 1h6m1.0s
2021/03/10 12:36:33 DEBUG : pacer: low level retry 10/10 (error googleapi: Err
or 403: User rate limit exceeded., userRateLimitExceeded)
2021/03/10 12:36:33 DEBUG : pacer: Rate limited, increasing sleep to 16.575937
443s
我们就先用这一份 1.2 TB 的资料来做测试吧。
首先 gd01 的资料在 [我的云端硬碟] -> [test2] 里,我们要转移到 gd02 [共用云端硬
碟] -> [test2] 里。
gd02 -> 共用云端硬碟 -> test2 -> 管理成员 -> 将你 gd01 的帐号输入并设定为 [管
理员] -> [共用]
要与机构外的使用者共用吗?
共用对象
[email protected] 不在这个项目所属的 Google Workspace 机构中。
选择 [一律共用]
到 gd01 -> 共用云端硬碟 -> test2 可以看到拥有者是 gd02 的组织
接下来我们建立 gd01tdtest2
rclone config
e/n/d/r/c/s/q> n
name> gd01tdtest2
Storage> 15
client_id>
client_secret>
scope> 1
root_folder_id>
service_account_file>
y/n>
y/n> n
按连结登入 gd01 帐号 -> 允许 -> 复制 code
Enter verification code> 贴上复制的 code
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / test
\ "0Axxx"
2 / test2
\ "0Axxx"
Enter a Shared Drive ID> 2
y/e/d>
e/n/d/r/c/s/q> q
接下来我们将 gd01 test2 移动到 gd01 Team Drive test2 里的 test2 目录,拥有者是
gd02 的网域不是 gd01 的。
rclone -vv move --drive-server-side-across-configs gd01:test2 gd01tdtest2
:test2
可以看到是 server-side
2021/03/10 15:03:02 INFO : xxxxx: Moved (server-side)
2021/03/10 15:03:03 INFO :
Transferred: 0 / 1.139 TBytes, 0%, 0 Bytes/s, ETA -
Checks: 80 / 84, 95%
Renamed: 80
Transferred: 0 / 5940, 0%
Elapsed time: 1m0.8s
等他跑完就完成将 gd01 [我的云端硬碟] 搬移到 gd02 拥有者的 [共用云端硬碟] 里了
。
第三篇 使用 rclone + --drive-server-side-across-configs + sa(Service Accounts)
我想使用 copy 的方式转移,不想使用 move 的方式转移,但是一个帐号有一天上传 750
GB 的限制该如何突破?
Rclone 750G自动换号– AutoRclone使用教程
https://gsuitems.com/index.php/archives/13/
https://github.com/xyou365/AutoRclone
第一步 安装必要软体
我们依我们从第一篇开始建立的 GCP centos7 来教学
回到 ssh 视窗
安装 git python36 输入
screen -S testsa
sudo yum install -y git python36
看到 Complete! 资料就是安装完成罗~
然後从 Github 下载代码并安装相关 Python 依赖包,输入
sudo git clone
https://github.com/xyou365/AutoRclone && cd AutoRclone && sudo
pip3 install -r requirements.txt
安装完毕後到这个网站
https://developers.google.com/drive/api/v3/quickstart/python
按下 [Enable the Drive API] 此时需要登入 google 帐号请登入 GCP 的帐号,登入完
毕後再按一次 [Enable the Drive API]
Enter new project name:自订我们输入satest
协议请选 Yes
按下 [NEXT]
Confi your OAuth client
预设的 Desktop app 即可
按下 [CREATE]
You're all set!
You're ready to start developing!
按下 [DOWNLOAD CLIENT CONFIGURATION]
将下载的 credentials.json 存到硬碟里
利用右上角的齿轮 -> 上传档案 -> 将刚刚下载的 credentials.json 上传
档案是传在 user home 里,所以输入
cd ~/AutoRclone
sudo mv ../credentials.json ./
ll
可以看到我们需要的 credentials.json 已经建立完毕
total 100
drwxr-xr-x. 2 root root 19 Mar 11 15:38 accounts
-rw-r--r--. 1 root root 2821 Mar 11 15:38 add_to_google_group.py
-rw-r--r--. 1 root root 3122 Mar 11 15:38 add_to_team_drive.py
-rw-r--r--. 1 root root 37075 Mar 11 15:38 AutoRclone.jpg
drwxr-xr-x. 2 root root 43 Mar 11 15:38 credentials
-rw-rw-r--. 1 dcshare dcshare 430 Mar 12 16:48 credentials.json
-rw-r--r--. 1 root root 13310 Mar 11 15:38 gen_sa_accounts.py
-rw-r--r--. 1 root root 18166 Mar 11 15:38 rclone_sa_magic.py
-rw-r--r--. 1 root root 7377 Mar 11 15:38 Readme.md
-rw-r--r--. 1 root root 93 Mar 11 15:38 requirements.txt
第二步 建立 Service Accounts 帐号
我们只需要建立一个项目,建立100个 Service Accounts 一天 75TB 就足够了。
输入
sudo python3 gen_sa_accounts.py --quick-setup 1 --new-only
如果你遇到这个错误
Traceback (most recent call last):
File "gen_sa_accounts.py", line 323, in <module> download_keys=args.download
_keys
File "gen_sa_accounts.py", line 161, in serviceaccountfactory
proj_id = loads(open(credentials,'r').read())['installed']['project_id']
File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quote
s: line 1 column 2 (char 1
代表你 credentials.json 不是用上传的方式,格式跑掉了~用这个方式传入 sudo bash
-c "echo '[ctrl]+[v]' > credentials.json" 是不行的喔!
点一下 Please visit this URL to authorize this application: 後面的连结。
使用 Google 帐户登入 -> 我们刚刚用 GCP 的帐号登入这里相同 -> 允许 -> 复制授权
码
贴到 Enter the authorization code: 里
如果出现下列字样
Service Usage API has not been used in project 123442485074 before or it is di
sabled. Enable it by visiting
https://console.developers.google.com/apis/api/s
erviceusage.googleapis.com/overview?project=xxxxx then retry. If you enabled t
his API recently, wait a few minutes for the action to propagate to our system
s and retry.
Press Enter to retry.
请点一下他给的连结记得登入的帐号是 GCP 的帐号才看的到。
Service Usage API -> 启用
在建立的时候会出现错误讯息
<HttpError 403 when requesting
https://iam.googleapis.com/v1/projects/xxxxxxxx
/serviceAccounts?pageSize=100&alt=json returned "Identity and Access Managemen
t (IAM) API has not been used in project 379544142899 before or it is disabled
. Enable it by visiting
https://console.developers.google.com/apis/api/iam.goo
gleapis.com/overview?project=xxxxx then retry. If you enabled this API recentl
y, wait a few minutes for the action to propagate to our systems and retry.".
我们点一下那个连结
https://console.developers.google.com/apis/api/iam.googleapis.com/overview?pro
ject=xxxxx
Identity and Access Management (IAM) API -> 启用
重新输入
sudo python3 gen_sa_accounts.py --quick-setup 1 --new-only
给他一点时间建立帐号
creat projects: 1
Creating 1 projects
Enabling services
Creating accounts in saf-18sxxxxx
Downloading keys from saf-18sxxxxx
输入
cd ~/AutoRclone/accounts
ll
可以看到一堆建立好的 json 档
批量提取 Service Accounts 参考
https://www.uud.me/qiwenzalun/autorclone-gclone.html/comment-page-1
输入
cat ~/AutoRclone/accounts/*.json | grep "client_email" | awk '{print $2}'| tr
-d ',"' | sed 'N;N;N;N;N;N;N;N;N;/^$/d;G' > ~/email.txt
底下的 user 请取代为你的使用者名称
这样在 /home/user 里就建立好 accounts 里的 email 清单并且 10 个分隔。
右上角 齿轮 -> 下载档案 -> 完整档案路径: /home/user/email.txt
确定下载 "email.txt" -> 另存新档
第三步 将 Service Accounts 帐号加入 Group 方便管理
对於普通 Google 帐号
直接建立一个 Google Group 然後手动将 service accounts 对应的信箱一个一个加进去
,但每次只能加10个,每24小时只能加100个。
https://groups.google.com/
网路论坛 -> 建立群组 -> 步骤 1 (共 3 步) 输入群组资讯
群组名称:dcsatest20210313
群组电子邮件:会自动带入我们填的群组名称
信箱的部分改为 @googlegroups.com
建立外部群组
-> 下一个
步骤 2 (共 3 步) -> 选择隐私权设定
谁可以搜寻群组 -> 群组成员
谁可以加入群组 -> 所有人皆可加入 我们加完後再来改
谁可以查看会话群组 -> 版主
谁可以张贴内容 -> 版主
谁可以查看成员 -> 版主
-> 下一个
步骤 3 (共 3 步) -> 新增成员
群组成员 -> 把 email.txt 前 10 个填进去
订阅 -> 不要接收电子邮件
预设开启 -> 直接新增成员,将成员直接新增到群组
-> 建立群组
须经人机验证 (Captcha) -> 我不是机器人 -> 建立群组 -> 前往群组 -> 成员 -> 成员
-> 新增成员
把 email.txt 剩下的 9组 10 个帐号陆续 新增成员
都加完後 -> 群组设定 -> 谁可以加入群组 -> 仅受邀的使用者 -> 储存变更
第四步 将来源与目的资料夹ID 加入群组信箱
[email protected] 的
权限
gd02 -> 共用云端硬碟 -> test2 -> 管理成员 -> 将你群组信箱 dcsatest20210313@goo
glegroups.com 的帐号输入并设定为 [管理员] -> [共用]
资料来源的资料夹也要加,如果来源不是 Team Drive 也可以开共用把群组信箱加为检视
者
第五步 开始复制遇到750GB 流量上限自动切换帐号
复制的用法为 SourceID=来源ID DestinationID=目的ID DestinationPathName=目的资料
夹名称 後面的 100 是我们建立的帐号数
python3 rclone_sa_magic.py -s SourceID -d DestinationID -dp DestinationPathNam
e -b 1 -e 100
SourceID 为你资料来源的网址 folders/ 後面那一段,我们假设为 hijklm
https://drive.google.com/drive/u/2/folders/hijklm
DestinationID 为你资料目的网址,我们用团队盘 folders/後面这串ID 我们假如是 abc
defg
https://drive.google.com/drive/u/1/folders/abcdefg
输入
cd ~/AutoRclone
sudo python3 rclone_sa_magic.py -s hijklm -d abcdefg -dp abcdefg -b 1 -e 100
就会如下开始开始复制罗
rclone is detected: /bin/rclone
generating rclone config file.
rclone config file generated.
Start: 07:02:58
rclone --config ./rclone.conf copy --drive-server-side-across-configs --rc --r
c-addr="localhost:5572" -vv --ignore-existing --tpslimit 3 --transfers 3 --dri
ve-chunk-size 32M --drive-acknowledge-abuse --log-file=log_rclone.txt "src001:
" "dst001:bd001" &
>> Let us go dst001: 07:02:58
dst001: 226GB Done @ 3245.456424MB/s | checks: 0 files
假如遇到
Failed to rc: connection failed: Post "
http://localhost:5572/core/pid": dial t
cp [::1]:5572: connect: connection refused
可能是权限或是路径的关系
看来源
rclone --config rclone.conf size --disable ListR src001:
没资料
Total objects: 0
Total size: 0 Bytes (0 Bytes)
有可能是新增的共用权限还没有完全同步完毕,资料越多同步需要越久。
再输入一次
rclone --config rclone.conf size --disable ListR src001:
权限有慢慢增加了
Total objects: 873
Total size: 3.192 TBytes (3509160308933 Bytes)
再次输入
cd ~/AutoRclone
sudo python3 rclone_sa_magic.py -s hijklm -d abcdefg -dp abcdefg -b 1 -e 100
当复制完成後做一下检查输入
rclone --config rclone.conf size --disable ListR src001:来源路径
rclone --config rclone.conf size --disable ListR dst001:目标路径
如果目标路径档案比较少那就重新复制一次
如果目标路径档案比较多那就去掉重复资料
rclone --config rclone.conf dedupe src001:来源路径
rclone --config rclone.conf dedupe dst001:目标路径
复制本地端的语法如下
cd ~/AutoRclone
sudo python3 rclone_sa_magic.py -sp YourLocalPath -d DestinationID -dp Destina
tionPathName -b 1 -e 100
之後大家再努力搬资料吧~
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 180.217.35.54 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Free_box/M.1615280338.A.6AB.html
1F:推 kobe8112: 推GCP教学,顺便问问有没有人用gclone server side copy03/09 17:11
2F:→ kobe8112: +多个sa自动切换,但大概都搬个1.X TB就遇到03/09 17:11
3F:→ kobe8112: user rate limit exceeded的? client ID有用自己的了 03/09 17:12
4F:推 ThisIsNotKFC: 推教学03/09 18:08
5F:推 MK47: 推认真文03/09 18:09
6F:推 zz12345567: 学校封锁第三方有解吗 rclone都无法用03/09 18:21
7F:推 refusekkk: 推03/09 18:22
8F:推 Aaso: 推 可是没多久又要再逃难了03/09 18:22
9F:推 shachitw: 专业03/09 20:42
10F:推 ch410773: 6楼,Google学术版有官方转移工具,不过那稳定性...03/09 21:25
11F:→ ch410773: 档案不多可以转移试试,我是转到失败QQ03/09 21:25
12F:推 a619063: 优文推 GCP也会受到单日750G的限制吗?03/09 21:46
13F:→ lux2668: 如果有上百T的资料 也可以这样传吗?03/09 22:04
14F:→ phost: 给一楼: 这限制起因就是 server side 被玩太凶,一路限制下03/09 22:08
15F:→ phost: 来的。1.xT 算有再开大了03/09 22:08
16F:推 crazyman7011: 双11花24镁买一台年付VPS(win版) 用AE慢慢移了 orz.03/09 22:46
17F:→ kobe8112: 谢谢14楼解答...只好慢慢搬...QQ03/09 23:13
18F:推 zz12345567: 感谢10楼 正在搬运中03/09 23:34
19F:→ iamdco: 目前现有的 无限方案 旧版 G Suite Business 和 SharePoin03/09 23:52
20F:→ iamdco: t Online 方案 2 我这边还有在徵团中,满团就截止。03/09 23:52
21F:→ iamdco: 欢迎站内信给我你的 Telegram 帐号聊聊~谢谢~03/09 23:52
22F:→ iamdco: 单日750GB上传限制是gd锁定的,不管用哪个虚拟机传都一样 03/09 23:55
23F:→ iamdco: 。03/09 23:55
24F:→ iamdco: 上百T都可以,注意传到非google服务的空间要付流量费用。03/09 23:56
25F:推 ChihAnChen: 推 有空来试试 03/10 00:00
26F:嘘 LeisCat: 搬家的话干嘛要跑复制,直接Server Side Move到团队盘再03/10 00:13
27F:→ LeisCat: 移到个人帐号更改权限就可以了03/10 00:13
28F:推 ian31722: 推03/10 01:47
29F:→ iamdco: to:LeisCat 你只是转移管理权限,实际上档案占用还是在之03/10 01:55
30F:→ iamdco: 前的帐号里,你在已转移管理权限的td,随便点一个档案,开03/10 01:55
31F:→ iamdco: 启[显示详细资料]->[详细资料]->[储存空间使用量] -> 拥03/10 01:55
32F:→ iamdco: 有者 这里,还是你之前组织的名称。03/10 01:55
33F:嘘 LeisCat: 你真的有看懂吗?首先Move到TD会将拥有权从原本的帐号转03/10 03:16
34F:→ LeisCat: 移给TD所在的组织,再来从TD移出可以转移给新的企业帐号03/10 03:16
35F:→ LeisCat: ,总共会有两次权限的转移,这部分在网页找个档案操作一03/10 03:16
36F:→ LeisCat: 次就知道了。其中TD只是作为中继使用,如果跟的企业版团03/10 03:16
37F:→ LeisCat: 开放TD权限甚至不用第二次的权限转移。03/10 03:16
38F:嘘 LeisCat: 再来TD不就是以不占用个人帐号的空间为特色吗?转移到TD03/10 03:19
39F:→ LeisCat: 後怎麽会占用原本帐号的空间?03/10 03:19
40F:推 Sayaka0714: 只把电影跟戏剧转出来了,A片就不理他了03/10 03:24
41F:→ lux2668: 没办法移动资料夹至TD喔 只有档案可以03/10 08:31
42F:→ kobe8112: 好像很多大神,想顺便请教一下:03/10 08:58
43F:→ kobe8112: 1.个人移到TD 2. A TD移到 B TD 3.TD移到个人03/10 08:59
44F:→ kobe8112: 4. A组织 TD 移到 B组织 个人 03/10 08:59
45F:→ kobe8112: 以上4种情况我只知道情况3是不算流量,想请问其他的限制03/10 09:00
46F:嘘 LeisCat: 正是因为只能移动档案才要使用rclone的server side move03/10 09:39
47F:→ LeisCat: 不然直接移就好了不是吗? 03/10 09:39
48F:推 LeisCat: 在讨论会不会计算流量之前,要先知道rclone在不同remote03/10 09:59
49F:→ LeisCat: 间传输档案是先在本地缓存src remote的数据块,再传输到d03/10 09:59
50F:→ LeisCat: est remote。所以不同remote间的copy和move最主要的差别03/10 09:59
51F:→ LeisCat: 就是後者会在copy完成後删除src的档案。03/10 09:59
52F:→ LeisCat: 但若是在相同remote上,且该服务支援档案路径移动的话,03/10 09:59
53F:→ LeisCat: 则可以使用Server Side Move,因此不会消耗流量。03/10 09:59
54F:→ LeisCat: 再来谈--drive-server-side-across-configs这个标签的意03/10 09:59
55F:→ LeisCat: 义,是将不同remote视为同一个remote操作。因此在copy中03/10 09:59
56F:→ LeisCat: 使用这个标签,即会调用GD的建立副本,达成Server Side C03/10 09:59
57F:→ LeisCat: opy的效果。03/10 09:59
58F:→ LeisCat: 回到正题,因为GD本身就支援TD和个人之间的移动,所以不03/10 09:59
59F:→ LeisCat: 会有传输过程,也就当然不会受到750G的传输限制。03/10 09:59
60F:→ kobe8112: 谢谢楼上回覆,我消化一下,感激不尽!03/10 10:06
61F:推 ThisIsNotKFC: 好猛,完全看不懂XD03/10 11:34
62F:→ lux2668: 请问大神 server side move 会掉档案吗?03/10 11:39
63F:→ lux2668: 个人盘移到TD盘的话...03/10 11:40
64F:推 koster: 感谢LeisCat提供关键字 网上蛮多详细教学的03/10 12:28
65F:→ koster: 我的理解就是用来搬家GD 突破750G限制的做法03/10 12:29
66F:推 wpc75: 看不懂leis大的说明....求详细教学 03/10 15:02
※ 编辑: iamdco (1.200.110.12 台湾), 03/10/2021 15:26:30
67F:→ iamdco: 谢谢 LeisCat 的指教,编辑增加第二篇教学 03/10 15:29
68F:→ kobe8112: i大,boolean类别的参数如果要设为true可以不需要带值 03/10 15:53
69F:→ kobe8112: --drive-server-side-across-configs 就可以了 03/10 15:54
70F:→ kobe8112: 另外如果是Google server side操作,也不需要透过GCP03/10 15:55
71F:→ kobe8112: 直接本机电脑就可以操作了 03/10 15:55
72F:推 ThisIsNotKFC: 感谢i大新增教学 03/10 16:34
73F:推 ThisIsNotKFC: i大请问,那转移到td後,是否要再server side move 03/10 16:43
74F:→ ThisIsNotKFC: 一次回企业版本个人gd 就是edu个人->TD->企业个人03/10 16:44
75F:→ iamdco: 看你自己需求,没有强迫要怎麽作~ 03/10 16:51
76F:推 ThisIsNotKFC: 了解thx 03/10 17:13
77F:推 ChihAnChen: 感谢新增教学 不过照L大讲的感觉不应该会碰到1.2T限流 03/10 18:13
78F:→ ChihAnChen: 才对? 03/10 18:13
79F:→ iamdco: copy 会 move 不会。 03/10 18:24
80F:推 ChihAnChen: 感谢解惑 03/11 01:21
※ 编辑: iamdco (1.200.170.216 台湾), 03/11/2021 12:29:15
※ 编辑: iamdco (1.200.170.216 台湾), 03/11/2021 12:31:06
81F:→ lonewind220: 我是直接移动到团队盘,顺便整理 03/12 14:37
82F:推 hcoaf: 感谢教学 03/12 21:10
※ 编辑: iamdco (1.200.98.177 台湾), 03/13/2021 05:32:36
※ 编辑: iamdco (1.200.98.177 台湾), 03/13/2021 07:44:10
83F:→ iamdco: 增加第三篇,使用sa帐号突破750gb限流 03/13 07:45
84F:推 ThisIsNotKFC: 感谢分享 03/13 13:24
85F:推 cxz123: 推,详细教学,赞 03/14 16:10
86F:→ iamdco: 回覆lux2668个人移到td,25tb 6526个档案移动都没掉。 03/15 15:08
87F:→ iamdco: 旧版 G Suite Business 已满团,谢谢。 03/15 17:03
88F:→ lux2668: 谢谢i大测试~~ 03/16 19:54
89F:推 ihatetolove: 借问还有人有在徵旧版 G Suite Business吗 谢谢 03/17 10:04
90F:推 louistop: 想跟旧版G Suite Business团~~~ 03/18 10:01
91F:推 Jay789521: 想跟旧版G Suite Business团+1 03/21 18:57
92F:嘘 LeisCat: 要用SSM的话没必要开GCP了,Windows就能跑rclone了 03/26 08:48
93F:推 RogerKao: 糗了,用move会自动ignore duplicate的档案… 04/07 00:26
94F:推 RogerKao: 刚刚得知似乎可以请网域管理员开启「使用网页移动资料夹 04/08 19:02
95F:→ RogerKao: 从我的云端硬碟到TD」不知道有没有人有这方面的资讯? 04/08 19:02
96F:→ iamdco: rclone指令直接移动就可以不用特别开 04/09 00:40
97F:推 RogerKao: 不 我是指使用网页移动资料夹至TD 而不是rclone 04/09 01:31
98F:→ iamdco: 刚刚在後台开启後你说的那个功能後,档案可以透过网页移 04/09 11:25
99F:→ iamdco: 动到td,但是资料夹不行,可能要等24小时权限同步完成後再 04/09 11:25
100F:→ iamdco: 测试一下。 04/09 11:25
101F:推 RogerKao: 再麻烦原PO帮忙测试一下了 感谢! 04/09 23:57
102F:→ iamdco: 目前测试只有管理员帐号可以移动资料夹,非管理员帐号只 04/11 00:09
103F:→ iamdco: 能移动档案。 04/11 00:09
104F:推 RogerKao: 不懂 这个管理员是指网域管理员吗? 资料夹的移动又是指 04/11 00:46
105F:→ RogerKao: 哪边到哪边呢? 04/11 00:46
106F:→ iamdco: 就你问的网页移动到td,一般帐号只能移档案,只有管理员自 04/11 11:18
107F:→ iamdco: 己的帐号可以移动资料夹。所以对一般帐号没有任何用处, 04/11 11:18
108F:→ iamdco: 除非你只移动档案,不移动资料夹。 04/11 11:18
109F:→ iamdco: 而且那个功能预设都没有开,建议你用rclone move比较快。 04/11 11:18