Skip to content

How to Create & Download Droplet Snapshots

Summary

One of the more difficult things to avoid when working with any vendor is vendor lock-in. In some instances, it's impossible to avoid, but avoiding it wherever possible is always a good approach.

I recently looked into the feasibility of migrating my DigitalOcean droplet to another hosting provider and found that it's harder than it seems. I found one approach, however, that can serve as an alternative to the built in snapshot capabilities of DigitalOcean.

How To

Warning

It's worth noting that the following approach will take significant space on your server's hard drive. You should ensure there is enough room prior to beginning.

In order to make this work, you'll need to perform the following:

  • SSH into your instance.
local$ ssh $USER@$SERVER_IP
  • Create a new backup directory, then navigate into it.
server# mkdir -p /backups
server# cd /backups
  • Generate a .tar.gz of your entire file system
server# tar -zcvpf /backups/img.tar.gz --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups .
  • Once completed, assuming you have Python installed, serve the file over HTTP and download it
# python2
server# python -m SimpleHTTPServer [port]

# python3
server# python3 -m http.server [port]

local$ wget http://$SERVER_IP:8000/img.tar.gz

References