News for hackers. Stuff that matters.
Re:Recovering a PostgreSQL database after a hard drive failure by csdvrx on Friday December 31, 2021 @03:12AM (#29745985)
If you are not as lucky and need to attack the underlying files to recover as much as you can in CSV form, try my small tool: https://github.com/csdvrx/pg_csdvrx

Or just watch the demo on https://raw.githubusercontent.com/csdvrx/pg_csdvrx/master/pg... where I corrupt a table to show how it works

Re:Recovering a PostgreSQL database after a hard drive failure by smbv on Friday December 31, 2021 @11:49AM (#29749767)
Working today to create a backup script and bind it to a systemd timer. Hope it all goes well.
Re:Recovering a PostgreSQL database after a hard drive failure by T3OU-736 on Saturday January 01, 2022 @12:28AM (#29755784)
(from bitter experience): Also consider periodically taking the backup and spinning it up on a separate host/VM.

And then codifying those steps into a script, so that if the time ever comes, restoring from backups is less of a fire drill.

Re:Recovering a PostgreSQL database after a hard drive failure by csdvrx on Friday December 31, 2021 @12:02PM (#29749912)
Add to your script the binary schema in case you ever need to use my tool it will make your life MUNCH simpler that reconstructing them by hand while fighting on multiple front to get your database back online...
Re:Recovering a PostgreSQL database after a hard drive failure by brightball on Friday December 31, 2021 @10:36AM (#29748931)
Thanks for putting this together. I could have seriously used it a few years ago.
Re:Recovering a PostgreSQL database after a hard drive failure by csdvrx on Friday December 31, 2021 @11:33AM (#29749577)
Well, I made it for a reason ;)

It is super simple and generic and could certainly be improved with a few days of work.

For ex: saving the schemas to a text file or a sqlite with PAR records for redundancy right when the db is created or the schemas changed, then more automated (say, given a set of schemas, chose the one the most likely given the data on hand and its possible interpretations, including say the range of values, even with a basic minimization of variance approach)

But then I may want to charge for the time and effort of coding that while I'm not in the business of data recovery... so feel free to improve on that when you start needing it, like the next time a disaster strikes :)