This question is very similar to Recommended procedure to remove old files after major version PostgreSQL database cluster upgrade, but I did the upgrade in a different way, so the answer might be/probably is different.
I administer a database on a headless Ubuntu system with disks very near capacity. Therefore, when I upgraded my database from Postgres 10 to Postgres 12, I used the --link option.
/usr/lib/postgresql/12/bin/pg_upgrade --old-datadir=/var/lib/postgresql/10/main \
--new-datadir=/var/lib/postgresql/12/main [stuff deleted] --link
This worked great, and now I have Postgres 12 running nicely. Time to cleanup.
I now have 2 folders in /var/lib/postgresql, called 10 and 12. The documentation suggests that these folders (or the files within them) are joined by a hard link, but doing the following suggests otherwise:
[deleted output from du that was misleading and did not say what I thought it said]
I'd like to clean this up as best I can, both because space is at a premium, and I know that there is a danger that future me will come along and delete 10 because we're on 12.
In this situation, what do I need, and what can I delete? How can I make the folder structure as clear as possible to my future self?
Are there things elsewhere I can delete?