Centos 7 挂载Google Drive硬盘

2018-11-07 135 次阅读 0 条评论 4.39k 个文字

安装Rclone

sudo su
yum -y install wget unzip nload htop fuse p7zip-full && wget https://downloads.rclone.org/v1.42/rclone-v1.42-linux-amd64.zip &&
unzip rclone-v1.42-linux-amd64.zip && cd rclone-v1.42-linux-amd64
cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone
mkdir -p /usr/local/share/man/man1
cp rclone.1 /usr/local/share/man/man1/
mandb

生成配置文件

rclone config

输出代码 在ssh客户端输入

[root@instance-1 rclone-v1.42-linux-amd64]# rclone config
2018/08/12 07:43:43 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
n/s/q> n                             # n 新建
name> gc                             # gc为你自定义的配置名,后面挂载要用到
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"
Storage> 11                                            # 选择你的云盘类型,这里选择 11
Google Application Client Id - leave blank normally.
client_id>                                              # 空白
Google Application Client Secret - leave blank normally.
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"
scope> 1                                                        # 选择 1 完全权限
ID of the root folder - leave blank normally.  Fill in to access "Computers" folders. (see docs).
root_folder_id>                                                     # 空白
Service Account Credentials JSON file path  - leave blank normally.
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?access_type=offline&client_id=202264815644.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=50113a7b81ea09222e635ad3754cbd40`
Log in and authorize rclone for access
Enter verification code> 4/OAAf8v6C6Bky_TdiRJVyXtJaIkUns04EyfOwc8OVWMLjvY070L_qTvs  #填你的授权码

Configure this as a team drive?
y) Yes
n) No
y/n> n                               # 不配置为驱动
--------------------
[gc]
type = drive
client_id = 
client_secret = 
scope = drive
root_folder_id = 
service_account_file = 
token = {"access_token":"ya29.Glv2BdTSMNhUfNCd8JiS9LCRfS4dc6UqVYLKL1VZkhF2__EcxUXg8h7l0fZ14gKPdQLmzETgOGwrvaI_fuTGnWTZW2jITXB0BvzOddOnFoNkJN_h7SNltE_ce36c","token_type":"Bearer","refresh_token":"1/nvZeSBgKwtZBb0YbgI2H0aAUMREqP7pF8D97zZadIfMC5qStkuFRlM8U8YOMtf6D","expiry":"2018-08-12T08:47:07.663944402+08:00"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y                     # 输入 y 确认配置   
Current remotes: 

Name                 Type
====                 ====
gc                   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 退出向导
You have new mail in /var/spool/mail/root
[root@instance-1 rclone-v1.42-linux-amd64]# cd

挂载Google Drive

你需要挂载的硬盘目录

你需要挂载的硬盘目录 下面 gc为配置文件 - /gc 为挂载目录

mkdir /gc 
rclone mount gc: /gc --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000  --vfs-cache-mode >= writes &

检查是否挂载成功

df -h

输出

[root@instance-1 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       100G   12G   89G  12% /
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           1.8G  816K  1.8G   1% /dev/shm
tmpfs           1.8G  186M  1.6G  11% /run
tmpfs           1.8G     0  1.8G   0% /sys/fs/cgroup
tmpfs           354M     0  354M   0% /run/user/0
tmpfs           354M     0  354M   0% /run/user/1011
gc:              15G  101M   15G   1% /gc

完成

列表中有gc: 15G 101M 15G 1% /gc则挂载成功

完结

我这次教程没有使用无限谷歌硬盘 进行挂载 只是用了普通的

其次网上好多 撸谷歌无限硬盘的教程。

 

O ever youthful, O ever weeping.

文章评论(0)