Syncing a Linux Filesystem with Google Drive
A simple and effective method to sync a Linux filesystem with GoogleDrive is the use google-drive-ocamlfuse.
- Add the PPA repository ppa:alessandro-strada/ppa and install the package (Ref: [[Using PPA Repositories]]) .
sh
add-apt-repository ppa:alessandro-strada/ppa
apt-get update
apt-get install google-drive-ocamlfuse
add-apt-repository ppa:alessandro-strada/ppa
apt-get update
apt-get install google-drive-ocamlfuse
- Authenticate with Google.
sh
google-drive-ocamlfuse
google-drive-ocamlfuse
- Choose or create a folder and mount your drive (~/GoogleDrive is a solid choice).
sh
mkdir ~/GoogleDrive
google-drive-ocamlfuse ~/GoogleDrive
mkdir ~/GoogleDrive
google-drive-ocamlfuse ~/GoogleDrive
Since the google-drive-ocamlfuse daemon doesn't start on boot, if your computer shuts down then you'll have two options.
- Remount the drive and start the daemon on every boot.
sh
google-drive-ocamlfuse -o nonempty ~/GoogleDrive
google-drive-ocamlfuse -o nonempty ~/GoogleDrive
- Use a System service to remount the drive and start the daemon automatically on boot (Ref: [[Using Systemd Service Files]]).
- Create the file /etc/systemd/system/google-drive-ocamlfuse.service
sh,
touch /etc/systemd/system/google-drive-ocamlfuse.service
touch /etc/systemd/system/google-drive-ocamlfuse.service
- Add the following contents to the file with all occurances of
your_user
replaced with your username.ini[Unit] Description=Google Drive OCamlFuse service file After=syslog.target network.target
[Unit] Description=Google Drive OCamlFuse service file After=syslog.target network.target
[Service] User=your_user Group=your_user ExecStart=google-drive-ocamlfuse -o nonempty /home/your_user/GoogleDrive
ExecStop=fusermount -u /home/your_user/GoogleDrive Restart=always
Type=forking
[Install]
WantedBy=multi-user.target
4. Start and enable the service.
```sh
systemctl start google-drive-ocamlfuse.service
systemctl enable google-drive-ocamlfuse.service
4. Start and enable the service.
```sh
systemctl start google-drive-ocamlfuse.service
systemctl enable google-drive-ocamlfuse.service
ADDITIONAL RESOURCES