dumb dumb dumb

"what the heck is this thing??"
"hmm... This is in the wrong place.."
"its just a stupid copy"
"you sure its just a copy"
"oh yeah yeah.. its just not in the right place"
"if it is not in the right place, it has no right to be"
rm -rf /.../postgres-main/
/etc/init.d/postgresql-8.1 stop
ERROR: could not find .... blah.. blah..
"MOMMMMMMMMMM... save me.."

So, thats how, a smooth upgrade from Debian Etch to Debian Lenny, turned out to be not so smooth. After the panic attack, the blabbering, the ranting and the running around office, I settled down and thought for a second. Unmounted the volume and started googling. There were two databases in it which are being used by the rest of the office. :-S Cant afford to lose them.

Since the actual database was on a tablespace that was still intact, my first attempt was to try and recover the databases from the tablespace. Something like, create a new main database and link the tablespace to it. But, looks like the main-database has a whole lot of shit linking back and forth with every available database. So, that seemed like a bad idea.

Then got on to 'ext3grep'. Though the guy (author) was giving some hope by mentioning how he had recovered his accidentally deleted 50k+ files, he was not helping at all with the disclaimer which seemed to be coming up on every second line in the manual :( However, after 3hours, ext3grep showed me all the files that were deleted in the recent past, and I saw the 'postgres' folder there .. Sigh!!. Another 1 hour to recover the files into a new folder. Then moved it to the original place and started PostgreSQL. That 10sec startup time seemed like 10hours. Finally it came up. Checked the databases, and everything seemed fine.

Phew.. Someone up there still loves me. :)

No comments: