安装google-drive-ocamlfuse
1 2 3 4 5 6 |
sudo add-apt-repository ppa:alessandro-strada/ppa sudo apt-get update sudo apt-get install google-drive-ocamlfuse 安装后使用 --help测试是否成功安装 sudo google-drive-ocamlfuse --help |
设置Google Drive授权
(官方教程)https://github.com/astrada/google-drive-ocamlfuse/wiki/Authorization
凭据申请地址>https://console.developers.google.com/projectselector/apis/credentials?supportedpurview=project
使用自己申请的ID和Secret 获得授权URL地址
非root用户需要到自己有执行权限的目录下运行以下命令,比如/home/用户名/目录
获取授权url方式1
1 2 3 4 5 |
cd /home/用户名/ google-drive-ocamlfuse -headless -label me -id xxxx.apps.googleusercontent.com -secret xxxx 注1:这里me为标签名,可自定义其他名称,使用标签这种方式支持多个google drive账号挂载. 注2:会在当前目录下创建配置目录/home/用户名/.gdfuse和配置文件. |
获取授权url方式2
1 |
google-drive-ocamlfuse -id xxxx.apps.googleusercontent.com -secret xxxx |
本机没有浏览器的话,会显示URL地址:
1 2 3 4 5 6 |
@ubuntu:~$ google-drive-ocamlfuse -id xxxx.apps.googleusercontent.com -secret xxxxx /bin/sh: 1: xdg-open: not found /bin/sh: 1: firefox: not found /bin/sh: 1: google-chrome: not found Couldn't get a file descriptor referring to the console Error: Error opening URL:https://accounts.google.com/o/oauth2/auth?client_id=497038872-qsaps89rs0sur7t66at9h9nxxxx.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force |
将上面的URL地址拷贝到浏览器中打开授权:
允许后获得登录授权码:
输入获取到的登录授权码:
在 Please enter the verification code: 后面输入上面浏览器获得的登录码:
1 2 3 4 5 6 7 |
google-drive-ocamlfuse -id xxxx.apps.googleusercontent.com -secret xxxx /bin/sh: 1: xdg-open: not found /bin/sh: 1: firefox: not found /bin/sh: 1: google-chrome: not found Please enter the verification code: 4/0xUITBU1mhDXtFzQWzQ389U-mfrxxxxxxxxxxxx <<输入授权码 Access token retrieved correctly. >>授权成功 |
挂载Google Drive云硬盘
创建挂载目录
1 |
mkdir /home/用户名/googledrive |
挂载
1 |
google-drive-ocamlfuse -label me /home/用户名/googledrive |
查看df -lh,显示如下最后一行成功
1 2 3 4 5 6 7 8 9 10 11 |
@ubuntu:~$ df -lh Filesystem Size Used Avail Use% Mounted on udev 486M 8.0K 486M 1% /dev tmpfs 100M 376K 99M 1% /run /dev/sda1 985G 2.7G 983G 1% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 497M 0 497M 0% /run/shm none 100M 0 100M 0% /run/user google-drive-ocamlfuse 8.0E 1.3T 8.0E 1% /home/用户名/googledrive |
rtorrent下载到Google Drive测试
总结:不能作为rtorrent的下载盘,会导致rtorrent的rpc失去响应.挂载的云硬盘丢失,原因未知.
测试1>
在挂载谷歌硬盘下创建 mkdir [wishoting]
添加时使用完整路径 /home/用户名/googledrive/[wishoting]
完成下载后ls查看会有新增了文件.文件越大上传的耗时越久,可能导致rutorrent假死.过几个小时或者一两天传输完毕可恢复.
1 2 |
@ubuntu:~/googledrive/[wishoting]$ ls 金古梁温 四侠合集.chm |
几十M小文件没问题,下载(4G)文件rtorrent就失去响应了
------------------------------------------
测试2>
2.1> 下载40M文件到谷歌硬盘成功.
2.2> 下载200M文件
提示[06.12.2017 06:07:48] Bad response from server: (500 [error,list]) Link to XMLRPC failed. May be, rTorrent is down?
查看挂载出现问题
1 2 |
@ubuntu:~/googledrive/wishosting$ df -lh df: ‘/home/用户名/googledrive’: Transport endpoint is not connected |