PostgreSQL data directory was accidentally deleted.
Right know I'm using photorec to recover all the files in the disk.
I also know from the docs the structure of that directory. There are text files for configuration and there are also files for tables, maps, indexes, toast, and so on grouped in subdirs by existing DBs.

My questions are:

  1. Can a software like photorec, to mention one, recover those postgresql files like it does with image, video, audio, office and pdf files?

  2. Let's say the files gets recovered. How can I restore the proper names of them and put them together under the correct subdir ?

Needless to say that there is no backup of any kind.

  • What operating system are you on? Is the drive currently mounted and write-enabled?
    – Philᵀᴹ
    May 26 at 19:59
  • Disk is secured from writing. OS is Windows Server 2012.
    – cachique
    May 26 at 20:00
  • Was the PG_WAL directory present? If so you can retrieve the data in the WAL log? May 26 at 20:15
  • All files and directories on disk were deleted. Remaining disk has no such directory so I assume is also gone.
    – cachique
    May 26 at 20:26
  • 1
    One does not delete a whole disk casually, does one? With a DB on it and no backup, too! It will be next to impossible to reconstruct all filenames, even if you can recover files. Well, maybe a forensic expert might know better. May 26 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.