26

I'm trying to do some detective work and am hunting down a PostgreSQL installation.

I've only got some low level access and cannot see inside the folder, but have found this likely candidate

/var/lib/pgsql/

Do you think my search is over?

Do you think my data is in there too?

I realise this is a highly stupid and speculative question. But I'm after a good guess.

2
  • It would be a lot less speculative if you told us how postgres ended up on the system. Was it compiled and installed manually? Or with a package manager? What Linux distro is this?
    – innaM
    Aug 10, 2009 at 15:36
  • It was installed as part of another piece of software called Lyris Listmanager. I believe this is the flavour Red Hat Linux 7.3 with PostgreSQL 7.3.2
    – Ian G
    Aug 11, 2009 at 7:08

2 Answers 2

32

For a description of what usually ends up in the /Var directory: http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/Linux-Filesystem-Hierarchy.html#var

/var/lib

Holds dynamic data libraries/files like the rpm/dpkg database and game scores. Furthermore, this hierarchy holds state information pertaining to an application or the system. State information is data that programs modify while they run, and that pertains to one specific host. Users shouldn't ever need to modify files in /var/lib to configure a package's operation. State information is generally used to preserve the condition of an application (or a group of inter-related applications) between invocations and between different instances of the same application. An application (or a group of inter-related applications) use a subdirectory of /var/lib for their data. There is one subdirectory, /var/lib/misc, which is intended for state files that don't need a subdirectory; the other subdirectories should only be present if the application in question is included in the distribution. /var/lib/'name' is the location that must be used for all distribution packaging support. Different distributions may use different names, of course.

I would bet your data is in there, but not the executable files.

1
  • Can you please provide some source/explanation for the but not the executable files part?
    – sumid
    Feb 3, 2021 at 17:55
5

/var/lib/pgsql is where Postgres stores all its internal data, including the data you put into a database. It's not, however, in a format that anybody could really see. Unlike MySQL which makes a separate file for each file and index, PostgreSQL stores its data in files with numeric names and in a dense opaque binary format.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .