Skip to content

Instantly share code, notes, and snippets.

@amalmurali47
Last active March 2, 2025 14:22
Show Gist options
  • Save amalmurali47/c58ef024683cccd242625995b45b7b72 to your computer and use it in GitHub Desktop.
Save amalmurali47/c58ef024683cccd242625995b45b7b72 to your computer and use it in GitHub Desktop.
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)
  • -X : preserve extended attributes (not included with -a)
  • -H : preserve hard links (not included with -a)
  • -v : verbose, mention files
  • --append-verify: if the files differ in modification or other timestamps, it will overwrite the target with the source without scrutinizing those files further
@flymikeGit
Copy link

In SSH config, would your-server need to be defined with root access? If not, then the root-owned files without world-read set would not be copied?
Many servers will be configured to deny root access via SSH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment