VPS+rclone copy 进行 Google Drive 盘间互拷

看到别人的无限容量 Google Drive 里面的好东西,想实实在在的转到自己的盘下…

而且大佬说盘间对拷可以不占用VPS的流量…

搞起!

1. 安装 rclone

curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64
sudo cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone
sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb (<- 可忽略)

2. 设置 rclone

1. 输入 rclone config
[[email protected] rclone-v1.42-linux-amd64]# rclone config
2018/06/30 15:19:06 NOTICE: Config file “/root/.config/rclone/rclone.conf” not found – using defaults
No remotes found – make a new one
n) New remote
s) Set configuration password
q) Quit config

2. 输入 n
n/r/c/s/q> n

3. 输入 remote1 给远程的drive起一个名字
name> remote1
Type of storage to configure.
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 / Local Disk
\ “local”
14 / Mega
\ “mega”
15 / Microsoft Azure Blob Storage
\ “azureblob”
16 / Microsoft OneDrive
\ “onedrive”
17 / OpenDrive
\ “opendrive”
18 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ “swift”
19 / Pcloud
\ “pcloud”
20 / QingCloud Object Storage
\ “qingstor”
21 / SSH/SFTP Connection
\ “sftp”
22 / Webdav
\ “webdav”
23 / Yandex Disk
\ “yandex”
24 / http Connection
\ “http”

4. 输入 11
Storage> 11
Google Application Client Id – leave blank normally.

5. 输入回车
client_id>
Google Application Client Secret – leave blank normally.

6. 输入回车
client_secret>
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value
1 / Full access all files, excluding Application Data Folder.
\ “drive”
2 / Read-only access to file metadata and file contents.
\ “drive.readonly”
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ “drive.file”
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ “drive.appfolder”
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ “drive.metadata.readonly”

7. 输入 1
scope> 1
ID of the root folder – leave blank normally. Fill in to access “Computers” folders. (see docs).

8. 输入回车
root_folder_id>
Service Account Credentials JSON file path – leave blank normally.
Needed only if you want use SA instead of interactive login.

9. 输入回车
service_account_file>
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine or Y didn’t work
y) Yes
n) No

10. 输入 n
y/n> n
If your browser doesn’t open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=20226481f5644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=f50fff0430212889b334d545a1bdeb80e4d
Log in and authorize rclone for access

11. 输入浏览器获取到的 code 选择 Google Drive
Enter verification code> 4/xxBKeD9W82nYOx1t5dzNLQJYDOIkjOzt1xJpSgfCy4zmwf41oNM8Oxx
Configure this as a team drive?
y) Yes
n) No

12. 输入 n 如果是团队盘请输入 y
y/n> n
——————–
[remote]
type = drive
client_id =
client_secret =
scope = drive
root_folder_id =
service_account_file =
token = {“access_token”:”xx29.GlvqBbPpiVAPcwQCUGlkKqxuF7HjZdFrCWTqsnBOD2kKNI5m-eWv_oRwz7hM7W0WpyXO1LnVlcvhqerkkFygA7O4zh6mwgKUGFpcH3UzlJgHH4osZdp4mApOdHxx”,”token_type”:”Bearer”,”refresh_token”:”1/xxBLS5Oxh9IUQyTvY9DCKkCaMiNF57_krDclH6OYgxx”,”expiry”:”2018-06-30T16:26:24.442741663+08:00″}
——————–
y) Yes this is OK
e) Edit this remote
d) Delete this remote

13. 输入 y
y/e/d> y
Current remotes:

Name Type
==== ====
remote drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config

14. 输入 q
e/n/d/r/c/s/q> q
[[email protected] rclone-v1.42-linux-amd64]#

最后生成的配置文件在,/root/.config/rclone/rclone.conf

3. 远程文件夹挂载到 VPS

rclone mount remote1: /home/D1 –allow-other –allow-non-empty –vfs-cache-mode writes &

将 Google Drive remote1 加载到本地文件夹 /home/D1。注意这三个选项,选项 –allow-other, –allow-non-empty, –vfs-cache-mode 打头的是双横线。

再按照1-3加载一个 remote2 到本地文件夹 /home/D2。

4. 盘间互拷贝(remote1 拷贝到 remote2)

rclone mkdir remote2:D_backup
clone copy -v remote1:D remote2:D_bakcup

将 remote1 中的文件夹 D 内容拷贝到 remote2 中的 D_backup 中。

漫长的等待… 至此便不怕别人取消分享,不怕别人 GD 挂了…

一些问题,
mount 加参数 –vfs-chche-mode 时报错,Fatal error: failed to mount FUSE fs: fusermount: exec: “fusermount”: executable file not found in $PATH
需要安装 fuse:apt-get install fuse

《VPS+rclone copy 进行 Google Drive 盘间互拷》上有1条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注