Downloading your Ubuntu droplet. Or the data in it.

I have recently put in some hours for organizing my two existing droplets – actually combining them into a single one. After a lot of cleanup, backing up and moving stuff – when everything seemed done and they were ready to be deleted, I still had a sour taste at the thought that I will delete something I used for almost three years.

Therefore, I decided to investigate on how I can download the information from digitalocean. Apparently, they don’t (yet) provide a way to safely do that, so some special commands are in order.

Mysql

The main database I have used was a MariaDB server. To backup everything I have used the command:

mysqldump -uroot -p<your password> --all-databases > /var/all_databases.sql

Everything

To create a backup of everything else, in the terminal on my machine I have used:

ssh root@<your droplet's ip address> "dd if=/dev/vda1 | gzip -1 -" | dd of=image.gz

Be aware that this command will take quite a long time to complete and that there is no progress indicator.

After this command, you will be prompted for your password. Also, add -p<your ssh port> if you have changed your default ssh port (which is highly recommended, by the way)

Sources