NOTE TO SELF: Variables may contain the value NULL from time to time.

I made the arguably daftest error of my self-taught Linux system administrator’s career on Thursday last week. In short, I managed to erase the entire /bin and /root directories with a well-placed rm -rf $VAR/-command in a shellscript I was working on. It also managed to remove most of the /dev-directory and a chunk from /etc.
Now, what happens when you run a command like that (as root, no less) and don’t consider the consequences should your $VAR be empty, is that your machine begins deleting your entire harddrive without prompting and whilst being vewy, vewy qwiet. It won’t stop unless you hit CTRL+C (but consider yourself lost if this command runs for more than a few milliseconds), or as in my case, when it comes across a busy device in /dev that it can’t delete. Note also, that using the ext3 filesystem precludes you from undeleting files, since deletion on this filesystem occurs by actually NULL’ing the inodes, instead of just flagging them as deleted like with ext2. Ah, the joys of a journaling filesystem.
*sigh* .. I decided to replace the machine’s harddrive and install Debian Testing (“Sarge”) from scratch. I then installed the old (crippled) harddrive in my Windows workstation and used a ext2 plugin for Total Commander to retrieve the files – it worked fine for ext3, probably because ext3 is backwards compatible. I ended up going for Apache 2 on this new machine, so there are some new features and security enhancements to play around with.
So .. let’s assume I learn from this. In which case I’ll allow myself to apply the words of Robert F. Kennedy to my blunder: “Only those who dare to fail greatly can ever achieve greatly.”
About this entry
You’re currently reading “NOTE TO SELF: Variables may contain the value NULL from time to time.,” an entry on achton.net
- Published:
- February 15th, 2005
No comments
Jump to comment form | comments rss [?] | trackback uri [?]