rclone掛載谷歌硬盤方法

rclone掛載google Drive

  • 最近查找大容量存儲工具,想到了免費版的Google雲盤,詢問了一下有一個無限空間的雲盤,話不多說開始搞,在淘寶買了個賬號開始配在自己的服務器上,但是發現並不是這麼好配,查找了很多資料,到最後朋友給我說rclone可以掛在Google雲盤,查了一下果然可以,把教程貼出來爲以後查看方便

首先安裝rclone

wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh

初始化配置

rclone config

  • 出現以下信息
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> Rats  #隨便填,後面要用到
Type of storage to configure.
Choose a number from below, or type in your own value
 1 / Amazon Drive
   \ "amazon cloud drive"
 2 / Amazon S3 (also Dreamhost, Ceph, Minio)
   \ "s3"
 3 / Backblaze B2
   \ "b2"
 4 / Box
   \ "box"
 5 / Cache a remote
   \ "cache"
 6 / Dropbox
   \ "dropbox"
 7 / Encrypt/Decrypt a remote
   \ "crypt"
 8 / FTP Connection
   \ "ftp"
 9 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
10 / Google Drive
   \ "drive"
11 / Hubic
   \ "hubic"
12 / Local Disk
   \ "local"
13 / Microsoft Azure Blob Storage
   \ "azureblob"
14 / Microsoft OneDrive
   \ "onedrive"
15 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
16 / Pcloud
   \ "pcloud"
17 / QingCloud Object Storage
   \ "qingstor"
18 / SSH/SFTP Connection
   \ "sftp"
19 / Webdav
   \ "webdav"
20 / Yandex Disk
   \ "yandex"
21 / http Connection
   \ "http"
Storage> 10  #選擇10,Google Drive
Google Application Client Id - leave blank normally.
client_id>  #留空 
Google Application Client Secret - leave blank normally.
client_secret>  #留空
Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
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
y/n> n  #選擇n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth....  #複製到瀏覽器打開,獲取驗證碼
Log in and authorize rclone for access
Enter verification code>  #填入上面獲取到的驗證碼
Configure this as a team drive?
y) Yes
n) No
y/n> y  #選擇y
Fetching team drive list...
No team drives found in your account--------------------
[Rats]
client_id = 
client_secret = 
service_account_file = 
token = {"access_token":"ya29.GltFBd7UJN2qrxdG8FnG_rMuB18ogb8QlujdL7glvXtfV"}
team_drive = 
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y  #選擇y
Current remotes:
 
Name                 Type
====                 ====
Rats                 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  #選擇q退出

掛載硬盤(這裏坑比較多)

  • 首先我們要在vps上創建一個文件夾(作爲Google雲盤的載體盤)

mkdir /root/GoogleDrive

  • 首先我們先創建雲盤文件夾

rclone mkdir test

  • 其次我們使用rclone開始掛載雲盤

rclone mount gdrive:test /root/GoogleDrive &

gdrive是谷歌雲盤標識

  • 卸載文件夾

fusermount -qzu GoogleDrive

GoogleDrive 爲你本地VPS載體文件夾

  • 我們開始上傳文件

rclone copy /root/test gdrive:test

/root/test爲本地文件 後面的爲谷歌雲盤標識及文件夾名字

  • 文件下載

rclone copy gdrive:test /root/test

我們下載到本地vps文件夾下

  • 列表

rclone ls gdrive:test

rclone lsl gdrive:test

顯示上傳時間

rclone lsd gdrive:test

只顯示文件夾

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章