↓ Skip to main content

Mount GDrive as systemd service

·86 words·1 min

Mount GDrive.

First of all configure rclone by following official RClone/Google Drive ➚ guide.

Config below mounts /private folder in GDrive on ~/GoogleDrive.

 1# ~/.config/systemd/user/rclone-gdrive-mount.service
 2[Unit]
 3Description=rclone mount GDrive
 4
 5[Service]
 6Type=notify
 7ExecStartPre=/usr/bin/mkdir -p %h/GoogleDrive
 8ExecStart=/home/linuxbrew/.linuxbrew/bin/rclone mount gdrive:private %h/GoogleDrive \
 9    --vfs-cache-mode full \
10    --vfs-write-back 5s \
11    --vfs-cache-max-size 500M \
12    --vfs-cache-max-age 720h \
13    --dir-cache-time 72h \
14    --poll-interval 1m
15ExecStop=/bin/fusermount3 -u %h/GoogleDrive
16TimeoutStopSec=60
17Restart=on-failure
18RestartSec=10
19
20[Install]
21WantedBy=default.target

Then run

systemctl --user daemon-reload
systemctl --user enable --now rclone-gdrive-mount.service
systemctl --user status rclone-gdrive-mount.service