Using Rclone To Add Free Cloud Storage For Your VPS
This guide walks you through the steps to mount all kinds cloud drives locally using Rclone. It use Google Drive as an example, and has been tested on Ubuntu 20.04 Linux, but the steps are same for other cloud drives, also fits for all other Linux and Unix distributions.
Linux Rclone related posts:
- Build Cloud Download Site Using One Docker (FileBrowser+Aria2+AriaNg+Rclone+Caddy)
- Use Aria2 docker+ariang to download and Rclone to Mount Google Drive and Sync
- Mount Google Drive into NextCloud Using Rclone
Similar post to add cloud storage for VPS:
Diagram
Installation
Ubuntu:
apt update -y && apt install rclone -y
CentOS
yum -y install epel-release
yum -y install wget unzip screen fuse fuse-devel
curl https://rclone.org/install.sh | sudo bash
Rclone Config
set_chinese_lang
apt-get autoremove -y
echo "Install Done!"
echo "Now you can reboot and connect port 3389 with rdp client"
echo "Note: chromium-browser is not displayed on the desktop, please start it manually if necessary"
echo "Default Username: rdpuser"
echo "Default Password: rdpuser_password"
Mount to local
mkdir -p /home/gdrive
rclone mount google-drive: /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes
Tip:google-drive is the Rclone configuration name.
Tip: ctrl+c to unmount in the ssh session
fusermount -qzu /home/gdrive
Tip: You also can mount one Google Drive's subfolder (for example, subfolder : backup) to local.
rclone mount google-drive:backup /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes
[root@centos7-test1 rclone]# cat rclone.conf
[google-drive]
type = drive
scope = drive
token = {"access_token":"ya29.a0Ae4lvC3NjPpY5EmltR-TaIh2_I3et3TqsXxbr73XnS0Gj19zalB4xke2FXosB8kThTG8akkjqc94ZjOoY8sLOokoxZf26YrUf04F14abUGRaGZTWznSGB","token_type":"Bearer","refresh_token":"1//0fqzXgAuJUWU2CgYIARAGA8SNwF-L9IrsitYDMEfAeJgOutDZV7OyqaWLjeoaj9mDw-e-4beZlwucBY8Br32tQM5cXFl7BnyLo","expiry":"2020-05-08T20:00:53.118819799Z"}
root_folder_id = 1lMF61yERYbDDjV86VmxQk0mJjwBwCH
Verify using command "df -k" to check local drivers, or using following command to check cloud drives:
[root@test1 data]# rclone ls google-drive:/
33196 3916278.html
1036266 69bbca83ly1gdr8plweo5g209e09yx6b.gif
42 test.test
Make it become service to start with system
To make rclone mount the google drive even after rebooted the vps, create /usr/lib/systemd/system/rclone.service with following information:
vi /usr/lib/systemd/system/rclone.service
[Unit]
Description=rclone
[Service]
User=root
ExecStart=/usr/bin/rclone mount google-drive: /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes
Restart=on-abort
[Install]
WantedBy=multi-user.target
systemctl start rclone
systemctl enable rclone
Use DD Command to Execute Disk Performance Test
Local HardDrive Performance Test
root@iubuntu-20-1:/# dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output
10240+0 records in
10240+0 records out
83886080 bytes (84 MB, 80 MiB) copied, 0.0591406 s, 1.4 GB/s
root@iubuntu-20-1:/# dd if=/dev/zero of=/tmp/output conv=fdatasync bs=384k count=1k; rm -f /tmp/output
1024+0 records in
1024+0 records out
402653184 bytes (403 MB, 384 MiB) copied, 0.345877 s, 1.2 GB/s
root@iubuntu-20-1:/#
Google Drive Performance Test:
root@iubuntu-20-1:/# dd if=/dev/zero of=/oss/output bs=8k count=10k; rm -f /oss/output
10240+0 records in
10240+0 records out
83886080 bytes (84 MB, 80 MiB) copied, 5.91952 s, 14.2 MB/s
root@iubuntu-20-1:/#
root@iubuntu-20-1:/# dd if=/dev/zero of=/oss/output conv=fdatasync bs=384k count=1k; rm -f /oss/output
1024+0 records in
1024+0 records out
402653184 bytes (403 MB, 384 MiB) copied, 15.3656 s, 26.2 MB/s
root@iubuntu-20-1:/#
Make Your Own Client ID
Document: https://rclone.org/drive/#making-your-own-client-id
Mount OneDrive
Videos
共有 0 条评论