Recovering from a 'rm -rf /'?



UPDATE

It was a hoax: That man who ‘deleted his entire company’ with a line of code? It was a hoax

hoax


Recently i read this ask on Serverfault:

I run a small hosting provider with more or less 1535 customers and I use Ansible to automate some operations to be run on all servers. Last night I accidentally ran, on all servers, a Bash script with a rm -rf {foo}/{bar} with those variables undefined due to a bug in the code above this line.

All servers got deleted and the offsite backups too because the remote storage was mounted just before by the same script (that is a backup maintenance script).

How I can recover from a rm -rf / now in a timely manner?


rm -rf


A few hours after the publication, ServerFault blocked the topic for this reason:

This post has been locked due to the high amount of off-topic comments generated.

A good lesson for all.

The solution?

safe-rm

Keep backups (really) offsite, and use Safe-rm:

Safe-rm is a safety tool intended to prevent the accidental deletion of important files by replacing /bin/rm with a wrapper, which checks the given arguments against a configurable blacklist of files and directories that should never be removed.


Published: April 13 2016