Report this

What is the reason for this report?

How to recover `rm -r` deleted folder

Posted on December 9, 2016

Dear community,

I have been working on some sites on my droplet, I went to delete a folder in the apps root and I accidentally deleted the entire apps root using rm -r (with f or a wildcard idr)

I know rm is dangerous command, I know I have to enable backups, but is there anyway I can recover all the files from the cloud? I went to use photorec but it tells me no hard disk found, meaning that’s cloud I assume.

I also have a backup archive but the sad thing is I had it stuck at 99% and cancelled, now I can tell it is corrupted archive and fixing it gives me only 2 folders while it is for the whole apps root.

Any thoughts?

TYVM!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

There are a few tools that can attempt to recovery data in this situation but it’s highly likely that the data will not be recoverable. A few threads that talk about various options are here, here and here

Heya,

Even though you mentioned you didn’t enable backups, it’s worth double-checking:

  1. DigitalOcean Snapshots:
  • Log in to your DigitalOcean Control Panel.
  • Navigate to the “Droplets” section.
  • Check if there are any snapshots that were taken automatically or manually. If you find one, you can create a new droplet from the snapshot to recover your files.
  1. Backups:
  • Again, check if you might have enabled backups at any point. These are different from snapshots and might provide another route to recovery.

If snapshots and backups are not available, you can try using testdisk to recover deleted files. testdisk is a powerful data recovery tool that can work in some cloud environments. You can also check this article:

https://www.digitalocean.com/community/tutorials/how-to-install-testdisk-on-linux-and-recover-deleted-files

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.