[LINUX] Backup digitalocean storage space to another s3 - fourslickz/notes GitHub Wiki

Steps: Install rclone: On most Linux distributions, you can install rclone with:

bash

sudo yum install rclone # For CentOS/RHEL-based systems
sudo apt install rclone # For Ubuntu/Debian-based systems

Configure rclone to Use DigitalOcean Space: Run rclone config to set up DigitalOcean Spaces. Follow the interactive prompts:

bash

rclone config

Type n to create a new remote. Choose a name for your remote (e.g., do-space-backup).

Select 4 for Amazon S3 storage type. Enter your DigitalOcean Spaces access key and secret key (found in your DigitalOcean dashboard).

For region, use the region of your Space (e.g., nyc3, sgp1).

For the endpoint, use https://[region].digitaloceanspaces.com (replace [region] with your region, e.g., nyc3).

Backup Command with rclone: Once the configuration is done, you can back up your DigitalOcean Space by syncing it to a local directory or another cloud storage:


To back up the contents of a DigitalOcean Space to a local directory:

bash

rclone sync do-space-backup:your-space-name /path/to/local/backup

To back up the contents to another cloud storage (e.g., AWS S3, Google Drive, etc.):

bash

rclone sync do-space-backup:your-space-name remote-cloud-storage:path/to/destination

Automate Backup with Cron (Optional): If you'd like to automate the backup process, add a cron job:

bash

crontab -e

Add a line like the following to run the backup script daily at midnight:

bash

0 0 * * * rclone sync do-space-backup:your-space-name /path/to/local/backup