How to Recover Data From an Offline Droplet in DigitalOcean

January 2020 · 3 minute read

I’ve spent a better part of my last 8 hours discussing with the DigitalOcean support team in the (failing) attempt to recover data from a disconnected droplet.

The story goes like this: I needed to move a droplet of mine from one account to another one (billing reasons). DigitalOcean doesn’t support it, but I still managed to hack my way out of it. I created a snapshot of the machine, and transferred its ownership to the other account. Then, I re-created the new droplet from the snapshot.

Unfortunately, the droplet had some custom network settings that weren’t matching the new environment. Long story short: the machine was completely disconnected from the Internet. No ssh, so ftp, no ping, nothing.

The support team has been super nice, and we tried everything to restore the connection. Nothing worked. In the end, they ended our email loop with a brutal “I’m truly sorry about that.

So… now what?

Enter Volumes

DigitalOcean has a very neat feature called Volumes. Think of them as external drives plugged into the machine.

Another neat feature is a browser-embedded VNC connection to the machine that completely bypass any kind of traditional connection (you can even see boot logs from it, for instance).

So what I did was going to the “Volumes” menu entry in the detail screen of my droplet. From there, you can add a volume.

Create a new volume

Create a new volume

The volume is attached to the Droplet and automatically mounted for you in the /mnt/ folder. In case it isn’t, you can do it yourself:

mkdir -p /mnt/your_volume_name
mount -o discard,defaults,noatime /dev/disk/by-id/your_volume_physical_location /mnt/your_volume_name

Ok cool. Now you can backup your data to the external drive:

cp -avr /usr/yourself/your_critical_data /mnt/your_volume_name

Great. If you want to be sure that everything went as expected, you can cd into the mounted drive and ls -hl to check.

Unmount the volume, and mount it back

Ok cool. Now, unmount the volume from your existing droplet. First, be sure that nothing else is touching it:

sudo lsof +f -- /mnt/your_volume_name

Then, you can move on with actually unmounting it (-l gently forces the umount, in case lsof is still making the device look busy):

sudo umount -l --verbose /mnt/your_volume_name

Finally, go to the DigitalOcean console, and detach the volume from the corrupted droplet:

Detach volume

Detach volume

Copy everything back!

Great! The last step consists of plugging the volume into another droplet (this one actually connected to the Internet!). It’s easy. From the console, attach your volume to the new, working droplet. Then (as before):

mkdir -p /mnt/your_volume_name
mount -o discard,defaults,noatime /dev/disk/by-id/your_volume_physical_location /mnt/your_volume_name

Done! You’ll have all your data in /mnt/your_volume_name, and you’ll be able to download it with no particular hassle.

Follow up

Thank you for reading. If you have any questions, feel free to shoot me an email at or tweet them @giansegato.

I've a non-lame 0-bullshit newsletter on startups, tech-enabled scalability and data-driven impact. Sign up to stay up to date and to keep this conversation open