分類
linux

Automounting google drive in Unbuntu 18.04

Automounting google drive

Conclusion

方法一:應該要是正確的設定,可惜還是需要開機後在terminal掛載

方法二:內建程式Startup Applications設定開機時欲執行指令即可

Install gdfuse (unoffical software to mount google drive)

使用Ubuntu內建的線上帳戶方式掛載google drive的效率極差,掛載很久且通常會失敗
還會出現gvsfd-google的process佔用資源,記憶體甚至佔用2-4G

Add the necessary PPA with the command:

sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt update

Install gdfuse:

sudo apt install google-drive-ocamlfuse

Sign in google account:

google-drive-ocamlfuse

執行指令後會跳至瀏覽器google授權界面

hunglin@hunglin-seagate:~$ google-drive-ocamlfuse
Access token retrieved correctly.

make a directory for mounting google drive:

mkdir  ~/Google-drive

mount google drive:

google-drive-ocamlfuse ~/Google-drive/

unmount:

fusermount -u ~/Google-drive

How to mount your Google Drive on Linux with google-drive-ocamlfuse

方法1

  1. 建立腳本並rename為gdfuse
    腳本內容:
#!/bin/bash
su hunglin -l -c "google-drive-ocamlfuse -label $1 $*"
exit 0
  1. 複製到 /usr/bin並給執行權限
sudo cp ~/Documents/gdfuse /usr/bin/
cd /usr/bin/
sudo chmod -x gdfuse #後來才知道-x是移除執行權限
  1. 編輯 /etc/fstab(開機時讀取掛載資訊的文件)
sudo gedit /etc/fstab

文件最後一列加上:

gdfuse#default  /home/hunglin/Google-drive     fuse  uid=1000,gid=1000,allow_other,user,_netdev     0       0
  1. 重啟後掛載至~/Google-drive目錄
    sudo reboot
    sudo mount ~/Google-drive
    [sudo] password for hunglin:
    /btn/sh: 1: gdfuse: Permission denied

    執行掛載時候報錯,顯示不允許

有個論壇的解決方法是在~/.gdfuse/default/state
將state改名為state.old即可解決,但我的沒有解決
而且重開機後state文件又會被建立

發表迴響