Hacker News new | past | comments | ask | show | jobs | submit login

LOL One day working on a very old machine many years ago in a galaxy far far away at the end of a 12 hour coding binge I accidentally typed:

   rm -f *.c
instead of:

   rm -f *.o
I then typed:

   make
I saw tons of missing files and in literally maybe 200ms I hit the reset button on the machines' console! I happened to be sitting there the only thing I could think is these blocks are still in the free list and maybe even the disk didn't sync yet (did I mention this was Xenix, and 1985?).

I rebooted the machine from a 8" floppy that had a copy of fsdb(ADM) and stated sniffing around. Sadly the file changes had been sync'd but I found my code on the free list in the filesystem! I then wrote a C program to dump the free blocks and proceeded to reassemble it into the original C file I needed to recoup my 12 hours of work. Luckily most of the files where the same from a prior backup just one file had a ton of changes from that session. It took me a couple hours to get perfect but it was better then re-writing everything I'd done in the past 12 hours.

Needless to say I then added a "make clean" target and I got much better at backing up my code every couple of hours instead of being a code zombie and waking up 12 hours later without backups!

With today's modern filesystems I have no clue how you could pull off a hat trick like this but that was then and I used the tools I had at my disposal to recover from my own blurry eyed mistake.

A friend of mine once said to me:

  It's not how bad you mess up it's how well you recover.
  And you're a professional at recovery.
I'm still not sure if that was a compliment or an insult...



With Linux, I seem to recall grepping the disk under /dev/ for the contents of the deleted file. It's actually why I still religiously put the name of the file at the top of the file, even though git has kept me from accidentally deleting anything in recent years.


I worry that svn and git have done more harm than good, because I've now got into the habit of using rm -rf (it's the only way to delete .git/.svn) where I used to use rm -r.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: