I did use pg_upgrade
.
I had a cluster of Postgresql with version 9.6 on my machine, and then I did start another cluster with version of v12. Each of them had separate data directories, in a directory scheme like this:
./postgresql/
├── 12
│ └── main
└── 9.6
└── main
Then I turned off the 9.6 cluster and started using the v12 one. But now, by accident, I found out that some of the files in the base
directory of the v12 cluster are not files, but symlinks to files in base
directory of the 9.6 one; For example:
./postgresql/12/main/base/16401/35093 -> ./postgresql/9.6/main/base/16402/35093
Why is it so? And, more importantly, how is it so?! I mean, I thought that the files inside base
directory are so internal to each DB that this could not be possible at all.
And, can I do something to disable using symlinks?
Best Answer
This is the result of a
pg_upgrade
with the-k
option, and these are not symbolic links, but hard links.If you didn't manage to start the old cluster after
pg_upgrade
everything is fine. You just forgot to remove the old cluster after upgrading. Do that right now:If you use
-k
, the upgrade process doesn't copy, but link the files. That makes the upgrade much faster, but renders the old cluster unusable.