Linux-Noob Forums
I am the biggest idiot alive - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Server Administration (https://www.linux-noob.com/forums/forum-8.html)
+--- Forum: LAMP (https://www.linux-noob.com/forums/forum-83.html)
+--- Thread: I am the biggest idiot alive (/thread-525.html)



I am the biggest idiot alive - cahlan - 2010-01-09


So, I'm working on our webhost via SSH (it's a dedicated virtual server) with root credentials ... and I type a command that may have just ruined my life.

 



Code:
rm -d -f -r /




 

I was in the process of cleaning out some directories with svn repos buried and getting ready to deploy a new repo. Now I don't know what I've deleted, but I've obviously screwed things up in a major way.

 

Here's what came up right afterward:

 



Code:
rm: cannot remove directory `//tmp': Device or resource busy
rm: cannot remove `//dev/pts/0': Operation not permitted




 

At that point I realized what I'd done and hit Ctrl+C. But I'm afraid the damage is done. The only command I could execute from cl after that was "cd," commands like "ls" won't work. FTP, SSH don't work, and the currently live websites are acting funky. Did I completely hose myself?




I am the biggest idiot alive - hybrid - 2010-01-09


At the risk of not being awfully helpful…

 

Yes. :(

 

You have a backup you can restore, right? Even if you manage to somehow salvage this install, you can never be completely sure everything is there that might need to be, so you’ll need to restore or reinstall I think.




I am the biggest idiot alive - anyweb - 2010-01-09


i'm just wondering why you did this

 



Code:
rm -d -f -r /




 

seems like a pretty complicated remove and one i've never used before, so please enlighten us noobs, why did you do it ?

i hope you had a backup and i'm sorry for the amount of time i'm sure it's gonna take to restore




I am the biggest idiot alive - Dungeon-Dave - 2010-01-16


Quote:So, I'm working on our webhost via SSH (it's a dedicated virtual server) with root credentials ...
That's kinda your mistake there, to start with.

 

The rest of your post suggests you're inexperienced, so it would have been safer to us a lower-privileged account to do your normal tasks then elevate yourself (via sudo or some other command) as and when needed - something referred to as the "Principle Of Least Privilege".

 

Essentially, your post could have just as easily read "I was playing with several guns and when I squeezed the trigger on one of them it rattled noisily for a while, causing several people around me to scream and fall in blood spurting from various locations. Now, I'm no expert in any of this, but did something go wrong?"

 

I know none of this is going to be of any consolation to you, but take stock of the fact that you're not the only person to have done it, and also in terms of a learning experience this is probably the only time you'll do it - you'll be much more cautious from now on.

 

What can help you now is some post-event analysis:

- What could you have done differently to prevent it? (policy, procedure, etc.)

- What have you had to do to recover it? If you had to recover it again, how can you make this process easier (disaster recovery plan)

 

Quote:so you’ll need to restore or reinstall I think.
Hybrid's suggestion there is the most truthful answer. In your position, I would get the server reinstalled then restore backups of my configs (apache files, etc) so that the server is reconfigured back into its original state, then recover my data back into the right areas. I know I'm able to do this since my backup strategy directs my recovery strategy - I have worked out what to copy off the server and how often in the event of a disaster.