Debian挂载Google Drive

安装google-drive-ocamlfuse

挂载Google Drive还是用google-drive-ocamlfuse,比较舒服。试过rclone,复制和移动命令总有各种问题。

以下操作默认以root用户登陆。

安装OPAM

apt install vim sudo software-properties-common ocaml
apt install opam

启动OPAM

opam init

更新OPAM

opam update

安装外部依赖

opam install depext
opam depext google-drive-ocamlfuse

安装google-drive-ocamlfuse

opam install google-drive-ocamlfuse

挂载

进入到Google Drive获取一个API,类型选择“其他”。接着输入以下命令绑定Google Drive的API。

sudo apt install xdg-utils --fix-missing

将client-ID、client-secret 替换为自己的。

google-drive-ocamlfuse -headless -label me -id client-ID -secret client-secret

之后会出现一行链接,复制、粘贴到浏览器,打开

mkdir /home/google-drive
google-drive-ocamlfuse -label me /home/google-drive

如果出现错误:

fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option

使用以下命令

google-drive-ocamlfuse -label me /home/google-drive -o nonempty

设置开机自启动

google-drive-ocamlfuse没有自启动的服务,因此需要手工添加,推荐添加命令到/etc/rc.local文件,但是Debian 9默认不带etc/rc.local文件,而rc.local服务却还是自带的。
一次复制以下命令并执行

cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
EOF

然后赋予权限

chmod +x /etc/rc.local

接着启动rc-local服务

systemctl start rc-local

然后添加以下命令到/etc/rc.local,放在exit 0前面即可。

su root -l -c 'google-drive-ocamlfuse -label me /home/gdrive'
点赞

发表评论

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