With vps data, you can use snapshot feature to backup all vps data but usually this’s a paid feature. Some of server provider don’t event have this feature. So to backup VPS you can use Rclone and move data to some of cloud storage such as: Google Drive, One Drive, Mega, Zoho storage…
Rclone is a command line program to manage files on cloud storage. It is a feature rich alternative to cloud vendors’ web storage interfaces. Over 40 cloud storage products support rclone including S3 object stores, business & consumer file storage services, as well as standard transfer protocols.
Rclone helps you:
- Backup (and encrypt) files to cloud storage
- Restore (and decrypt) files from cloud storage
- Mirror cloud data to other cloud services or locally
- Migrate data to cloud, or between cloud storage vendors
- Mount multiple, encrypted, cached or diverse cloud storage as a disk
- Analyse and account for data held on cloud storage using lsf, ljson, size, ncdu
- Union file systems together to present multiple local and/or cloud file systems as one
To install Rclone on Linux/Mac/BSD you can use this command:
curl https://rclone.org/install.sh | sudo bash
Below is some of popular commands of rclone
Command | Description |
---|---|
rclone | Show help for rclone commands, flags and backends. |
rclone cleanup | Clean up the remote if possible. |
rclone config | Enter an interactive configuration session. |
rclone config create | Create a new remote with name, type and options. |
rclone config delete | Delete an existing remote name . |
rclone config disconnect | Disconnects user from remote |
rclone config dump | Dump the config file as JSON. |
rclone config edit | Enter an interactive configuration session. |
rclone config file | Show path of configuration file in use. |
rclone config password | Update password in an existing remote. |
rclone config providers | List in JSON format all the providers and options. |
rclone config reconnect | Re-authenticates user with remote. |
rclone config show | Print (decrypted) config file, or the config for a single remote. |
rclone config update | Update options in an existing remote. |
rclone config userinfo | Prints info about logged in user of remote. |
rclone copy | Copy files from source to dest, skipping already copied. |
rclone copyto | Copy files from source to dest, skipping already copied. |
rclone copyurl | Copy url content to dest. |
rclone cryptcheck | Cryptcheck checks the integrity of a crypted remote. |
rclone cryptdecode | Cryptdecode returns unencrypted file names. |
rclone dedupe | Interactively find duplicate filenames and delete/rename them. |
rclone delete | Remove the files in path. |
rclone deletefile | Remove a single file from remote. |
rclone genautocomplete | Output completion script for a given shell. |
rclone genautocomplete bash | Output bash completion script for rclone. |
rclone genautocomplete fish | Output fish completion script for rclone. |
rclone genautocomplete zsh | Output zsh completion script for rclone. |
rclone gendocs | Output markdown docs for rclone to the directory supplied. |
rclone hashsum | Produces a hashsum file for all the objects in the path. |
rclone link | Generate public link to file/folder. |
rclone listremotes | List all the remotes in the config file. |
rclone ls | List the objects in the path with size and path. |
rclone lsd | List all directories/containers/buckets in the path. |
rclone lsf | List directories and objects in remote:path formatted for parsing. |
rclone lsjson | List directories and objects in the path in JSON format. |
rclone lsl | List the objects in path with modification time, size and path. |
rclone md5sum | Produces an md5sum file for all the objects in the path. |
rclone mkdir | Make the path if it doesn’t already exist. |
rclone mount | Mount the remote as file system on a mountpoint. |
rclone move | Move files from source to dest. |
rclone moveto | Move file or directory from source to dest. |
rclone ncdu | Explore a remote with a text based user interface. |
rclone obscure | Obscure password for use in the rclone config file. |
rclone purge | Remove the path and all of its contents. |
rclone rc | Run a command against a running rclone. |
rclone rcat | Copies standard input to file on remote. |
rclone rcd | Run rclone listening to remote control commands only. |
rclone rmdir | Remove the empty directory at path. |
rclone rmdirs | Remove empty directories under the path. |
rclone selfupdate | Update the rclone binary. |
rclone serve | Serve a remote over a protocol. |
rclone serve dlna | Serve remote:path over DLNA |
rclone serve ftp | Serve remote:path over FTP. |
rclone serve http | Serve the remote over HTTP. |
rclone serve restic | Serve the remote for restic’s REST API. |
rclone serve sftp | Serve the remote over SFTP. |
rclone serve webdav | Serve remote:path over webdav. |
rclone settier | Changes storage class/tier of objects in remote. |
rclone sha1sum | Produces an sha1sum file for all the objects in the path. |
rclone size | Prints the total size and number of objects in remote:path. |
rclone sync | Make source and dest identical, modifying destination only. |
rclone test | Run a test command |
Here is an overview of the major features of each cloud storage system Rclone supports.
Name | Hash | ModTime | Case Insensitive | Duplicate Files | MIME Type |
---|---|---|---|---|---|
1Fichier | Whirlpool | No | No | Yes | R |
Amazon Drive | MD5 | No | Yes | No | R |
Amazon S3 | MD5 | Yes | No | No | R/W |
Backblaze B2 | SHA1 | Yes | No | No | R/W |
Box | SHA1 | Yes | Yes | No | – |
Citrix ShareFile | MD5 | Yes | Yes | No | – |
Dropbox | DBHASH ¹ | Yes | Yes | No | – |
Enterprise File Fabric | – | Yes | Yes | No | R/W |
FTP | – | No | No | No | – |
Google Cloud Storage | MD5 | Yes | No | No | R/W |
Google Drive | MD5 | Yes | No | Yes | R/W |
Google Photos | – | No | No | Yes | R |
HDFS | – | Yes | No | No | – |
HTTP | – | No | No | No | R |
Hubic | MD5 | Yes | No | No | R/W |
Jottacloud | MD5 | Yes | Yes | No | R |
Koofr | MD5 | No | Yes | No | – |
Mail.ru Cloud | Mailru | Yes | Yes | No | – |
Mega | – | No | No | Yes | – |
Memory | MD5 | Yes | No | No | – |
Microsoft Azure Blob Storage | MD5 | Yes | No | No | R/W |
Microsoft OneDrive | SHA1 | Yes | Yes | No | R |
OpenDrive | MD5 | Yes | Yes | Partial | – |
OpenStack Swift | MD5 | Yes | No | No | R/W |
pCloud | MD5, SHA1 | Yes | No | No | W |
premiumize.me | – | No | Yes | No | R |
put.io | CRC-32 | Yes | No | Yes | R |
QingStor | MD5 | No | No | No | R/W |
Seafile | – | No | No | No | – |
SFTP | MD5, SHA1 | Yes | Depends | No | – |
SugarSync | – | No | No | No | – |
Tardigrade | – | Yes | No | No | – |
WebDAV | MD5, SHA1 | Yes | Depends | No | – |
Yandex Disk | MD5 | Yes | No | No | R |
Zoho WorkDrive | – | No | No | No | – |
The local filesystem | All | Yes | Depends | No | – |
Backup vps data to Google Drive
After installed Rclone you type
[root@racknerd racknerd]# rclone config
Current remotes:
Name Type
==== ====
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> learncode24h_com
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / 1Fichier
\ "fichier"
2 / Alias for an existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Citrix Sharefile
\ "sharefile"
9 / Compress a remote
\ "compress"
10 / Dropbox
\ "dropbox"
11 / Encrypt/Decrypt a remote
\ "crypt"
12 / Enterprise File Fabric
\ "filefabric"
13 / FTP Connection
\ "ftp"
14 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
15 / Google Drive
\ "drive"
16 / Google Photos
\ "google photos"
17 / Hadoop distributed file system
\ "hdfs"
18 / Hubic
\ "hubic"
19 / In memory object storage system.
\ "memory"
20 / Jottacloud
\ "jottacloud"
21 / Koofr
\ "koofr"
22 / Local Disk
\ "local"
23 / Mail.ru Cloud
\ "mailru"
24 / Mega
\ "mega"
25 / Microsoft Azure Blob Storage
\ "azureblob"
26 / Microsoft OneDrive
\ "onedrive"
27 / OpenDrive
\ "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
29 / Pcloud
\ "pcloud"
30 / Put.io
\ "putio"
31 / QingCloud Object Storage
\ "qingstor"
32 / SSH/SFTP Connection
\ "sftp"
33 / Sugarsync
\ "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
\ "tardigrade"
35 / Transparently chunk/split large files
\ "chunker"
36 / Union merges the contents of several upstream fs
\ "union"
37 / Webdav
\ "webdav"
38 / Yandex Disk
\ "yandex"
39 / Zoho
\ "zoho"
40 / http Connection
\ "http"
41 / premiumize.me
\ "premiumizeme"
42 / seafile
\ "seafile"
Storage> 15
** See help for drive backend at: https://rclone.org/drive/ **
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id>
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Full access all files, excluding Application Data Folder.
\ "drive"
rclone configy/n> n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> n
Please go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=11111111.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=****************
Log in and authorize rclone for access
Enter verification code> ******************************************
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
--------------------
[learncode24h_com]
type = drive
scope = drive
token = {"access_token":"************","token_type":"Bearer","refresh_token":"**********","expiry":"2021-04-21T11:40:40.21300654+07:00"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
ducquyen_dev drive
leducquyen_it drive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
You access generated link by Rclone to grant permission read/write for Rclone and get access token then enter it in terminal like this
That’s all with Rclone. After backup data you type rclone copy to push file to cloud storage
rclone copy /home/backup.tar.gz learcode24h_com:backup_folder
- learncode24h_com is my remote name configured for my Google Drive
- backup_folder is folder contains backup data on my Google Drive
For deleting old backup data you can use this command:
rclone -q --min-age 1w delete learncode24h_com:backup_folder #Remove all backups older than 1 week