How to Recover Data from Droplets with the Recovery ISO

If you need to recover data from your Droplet, you can use DigitalOcean’s recovery ISO to regain access and perform recovery operations, like getting access to an interactive shell, running fsck, or chrooting into the system.

There are several situations in which you may want to use the recovery ISO:

  • Your Droplet was disconnected from the network due to an outgoing flood or DDoS. Unusually large amounts of traffic usually indicate that your Droplet was compromised and used to send spam or malicious traffic. In this case, you’ll have received an email from support disabled your Droplet’s normal internet access to protect others from being harmed.

    In this case, you can use the recovery ISO to regain access to the Droplet’s filesystem. Then you can put in a support request to enable the Droplet’s network connection so you can recover any files and migrate to a new Droplet.

  • Your Droplet’s file system is corrupted. File system corruption can happen when software or hardware malfunctions or when your Droplet is abruptly powered off.

    The best way to prevent data loss in those situations is with good backups, but you can use the recovery ISO to run fsck, mount the disk image, or attempt more advanced recovery procedures.

This process involves three steps:

  1. Boot into the recovery ISO from the control panel after powering down the Droplet.

  2. Prepare the Droplet for recovery. For example, if the Droplet has been disconnected from the network, contact support to reconnect it. If the Droplet’s filesystem is corrupted, use the recovery ISO to run fsck.

  3. Recover data by migrating files off the Droplet using Filezilla, scp/SFTP, or other tools and techniques, depending on your situation.

Boot into the Recovery ISO

First, power off the Droplet in the safest way available to you. If you have access to the command line, you can use the sudo poweroff command. If you do not have access to the command line, you can power off the Droplet using the toggle on the Droplet’s page in the control panel.

Once the Droplet is powered off, you can reboot it from the recovery ISO. In the control panel, click Recovery on the left, then click the Boot from Recovery ISO box:

recovery ISO selection

Next, toggle the power button to power your Droplet back on. When it’s on, access the Droplet by clicking on Access to the left, then clicking the Launch Console button. You’ll see a menu like this:

This droplet is booted to the DigitalOcean recovery environment.
When you are finished, you may set your Droplet to boot from
the local disk again via the DigitalOcean control panel.

This rescue environment is based on Ubuntu 18.04.

* Network access and SSH have been enabled automatically *
* SSH Host keys will NOT match while using this rescue system *

Root Password has randomly been set to:
  exam-ple0-1234-5678
Your are strongly encouraged to use SSH keys. To import your SSH
public keys:
  From Github:        ssh-import-id gh:<Github user name>
  From Launchpad.net: ssh-import-id lp:<launchpad user name>
--------------------------------------------------------------------
1. Mount your Disk Image [Not Mounted]
2. Check Filesystem
3. Reset Droplet Root Password
4. Configure Keyboard
5. Attempt to 'chroot' into installed system
6. Interactive Shell [/bin/bash]
Choose (1-6) and press Enter to continue.

The recovery ISO provides a number of options. Which ones you use to prepare the Droplet for recovery depends on the state of the Droplet.

Prepare the Droplet for Recovery

Network Disconnected

If your Droplet is in a network disconnected state (due to sending an outgoing flood or DDoS, for example), open a support ticket to have it reconnected. The restored network connection will allow you to transfer files off of the Droplet. From there, you can use option 1 in the recovery ISO to mount your disk image and gain access to your files.

File System Corruption

If you’re trying to recover from file system corruption, you can use option 2 in the recovery ISO to run fsck, a filesystem check program. fsck can occasionally cause data corruption on active disks, so only attempt this on an unmounted file system.

Using fsck as a recovery option can be useful, but it comes with risks and isn’t guaranteed to work, so consider it a last resort method of data recovery. We recommend taking a snapshot of your Droplet first. If the recovery causes data loss, you can restore from the snapshot and try again or use a different method.

After it completes, you will have to mount the filesystem into your environment using option 1 in order to access your files. This is because that Linux environment is running from the ISO image, not from the Droplet. Your disk image will be detected and mounted under /mnt in the recovery environment. Then use option 6 to enter the interactive shell and look for recovered files in the /mnt/lost+found directory.

Recover Data

Migrate Files

Once your Droplet is prepared, you can offload your files onto a remote machine (like another Droplet or another physical machine). You can use SFTP from the command line or with an SFTP client like Filezilla. Make sure to use the temporary password in the recovery menu when you set up the connection.

You can SSH to the Droplet while it’s in recovery using the temporary password in the recovery menu. You’ll need to use a screen, tmux, or byobu session. Your SSH keys will not work while the Droplet is in recovery, but you can import SSH keys from GitHub following the instructions in the recovery menu. The Droplet’s host key will also not match, so you may have to delete it from the ~/.ssh/known_hosts file on your local computer.

You can also chroot into the filesystem to try more advanced recovery steps. For example, this may allow you to start MySQL so you can attempt to export your databases.

Restore the Droplet

If you were recovering from file system corruption or other problems and the recovery went well, meaning the Droplet itself is salvageable, you can power off from the command line again:

poweroff

Then, back in the control panel, click Recovery and choose the radio button for Boot from Hard Drive. When you power the Droplet back on, it will attempt to boot from its own disk.